Do not unset SWAYSOCK if not running on a sxmo device

If you run sway on a desktop, if you install sxmo-utils, then your
terminal emulators will not have SWAYSOCK available anymore.

To avoid this, we only unset SWAYSOCK if the sxmo.swaysock file is
present. We keep this behavior to ensure we unset SWAYSOCK when
toggeling from sway to dwm by example.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
This commit is contained in:
Stacy Harper
2022-02-07 11:49:29 +01:00
committed by Peter John Hartman
parent 1b9eae23d4
commit 093722e430

View File

@@ -6,6 +6,7 @@ _sxmo_is_running() {
unset SXMO_WM unset SXMO_WM
if [ -f "${XDG_RUNTIME_DIR:-/dev/shm/user/$(id -u)}"/sxmo.swaysock ]; then if [ -f "${XDG_RUNTIME_DIR:-/dev/shm/user/$(id -u)}"/sxmo.swaysock ]; then
unset SWAYSOCK
if SWAYSOCK="$(cat "${XDG_RUNTIME_DIR:-/dev/shm/user/$(id -u)}"/sxmo.swaysock)" \ if SWAYSOCK="$(cat "${XDG_RUNTIME_DIR:-/dev/shm/user/$(id -u)}"/sxmo.swaysock)" \
swaymsg 2>/dev/null; then swaymsg 2>/dev/null; then
printf "Detected the Sway environment\n" >&2 printf "Detected the Sway environment\n" >&2
@@ -76,7 +77,6 @@ _sxmo_load_environments() {
_sxmo_grab_session() { _sxmo_grab_session() {
if ! _sxmo_is_running; then if ! _sxmo_is_running; then
unset SWAYSOCK
return return
fi fi