sh: Fix graphical session start for ssh sessions
The autostart function would accidentally start multiple new graphical sessions in one terminal when connected to the machine over sshd. This should fix multiple starts while keeping the old functionality and speed of checking intact.
This commit is contained in:
parent
792e0b930a
commit
5ee71ae705
1 changed files with 15 additions and 2 deletions
|
@ -1,9 +1,22 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# simple check for running graphical session
|
||||
if [ -n "$DISPLAY" ] || [ -z "$XDG_VTNR" ] || [ "$XDG_VTNR" -ne 1 ]; then
|
||||
return
|
||||
return
|
||||
fi
|
||||
|
||||
# more involved check for running graphical session
|
||||
# but figures it out for weird sshd sessions as well
|
||||
if [ "$(loginctl show-session "$(loginctl show-user "$(whoami)" -p Display --value)" -p Type --value)" = 'wayland' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# just in case we are running x11 and this wants
|
||||
# to automatically start wayland, stop it from doing so
|
||||
if [ "$(loginctl show-session "$(loginctl show-user "$(whoami)" -p Display --value)" -p Type --value)" = 'x11' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if command -v river >/dev/null 2>&1; then
|
||||
river
|
||||
river
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue