Fix desktop auto launch

This commit is contained in:
Connor Nelson
2025-03-20 10:52:06 -07:00
parent a4227a7758
commit 80c42066a0
+13 -10
View File
@@ -4,22 +4,25 @@ PATH="/run/dojo/bin:$PATH"
USER="hacker" USER="hacker"
xfce_env() { xfce_env() {
local session_pid local session_pid
session_pid=$(pgrep -u "$USER" xfce4-session | head -n1) session_pid=$(pgrep -u "$USER" xfce4-session | head -n1)
xargs -0 -a /proc/"$session_pid"/environ xargs -0 -a /proc/"$session_pid"/environ
} }
xfce_run() { 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. # Launch a background process that waits for xfce4-session and then runs the command.
( (
while ! pgrep -u "$USER" xfce4-session > /dev/null; do while ! pgrep -u "$USER" xfce4-session > /dev/null; do
sleep 1 sleep 1
done done
# Consider using `--geometry` to set the window size and position # Consider using `--geometry` to set the window size and position
# Consider using `--fullscreen` to launch the application in fullscreen mode # Consider using `--fullscreen` to launch the application in fullscreen mode
xfce_run exo-open --launch TerminalEmulator xfce_run exo-open --launch TerminalEmulator
) & ) &