From 80c42066a00ba7459a074305c0db4f591d6afd1d Mon Sep 17 00:00:00 2001 From: Connor Nelson Date: Thu, 20 Mar 2025 10:52:06 -0700 Subject: [PATCH] Fix desktop auto launch --- demo/desktop-auto-launch/.init | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/demo/desktop-auto-launch/.init b/demo/desktop-auto-launch/.init index 2d02834..e2c73af 100644 --- a/demo/desktop-auto-launch/.init +++ b/demo/desktop-auto-launch/.init @@ -4,22 +4,25 @@ PATH="/run/dojo/bin:$PATH" USER="hacker" xfce_env() { - local session_pid - session_pid=$(pgrep -u "$USER" xfce4-session | head -n1) - xargs -0 -a /proc/"$session_pid"/environ + local session_pid + session_pid=$(pgrep -u "$USER" xfce4-session | head -n1) + xargs -0 -a /proc/"$session_pid"/environ } xfce_run() { - setsid su "$USER" -c "env - $(xfce_env) $*" + id + which su + echo "$USER" + setsid runuser "$USER" -c "env - $(xfce_env) $*" } # Launch a background process that waits for xfce4-session and then runs the command. ( - while ! pgrep -u "$USER" xfce4-session > /dev/null; do - sleep 1 - done + while ! pgrep -u "$USER" xfce4-session > /dev/null; do + sleep 1 + done - # Consider using `--geometry` to set the window size and position - # Consider using `--fullscreen` to launch the application in fullscreen mode - xfce_run exo-open --launch TerminalEmulator + # Consider using `--geometry` to set the window size and position + # Consider using `--fullscreen` to launch the application in fullscreen mode + xfce_run exo-open --launch TerminalEmulator ) &