diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session index 83777ced29..1cda0cff97 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-session +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-session @@ -116,7 +116,7 @@ prepare_locale() { clear_stale_tmp() { local running names=() n - running=$(pgrep -af 'steamwebhelper|steamrtarm64/steam|steamrt64/steam|--type=|droiddeck-appimage-run|dbus-run-session|dbus-daemon.*--session|dbus-launch|kwin|plasmashell' 2>/dev/null) + running=$(pgrep -af 'steamwebhelper|steamrtarm64/steam|steamrt64/steam|--type=|droiddeck-appimage-run|dbus-run-session|dbus-daemon.*--session|dbus-launch|kwin|plasmashell|Xwayland|Xorg|Xvfb|Xvnc|gamescope' 2>/dev/null) case $running in *steamwebhelper* | *steamrtarm64/steam* | *steamrt64/steam*) ;; *) names+=(-o -name 'mangohud.????????' -o -name '.com.valvesoftware.Steam.??????' @@ -132,6 +132,10 @@ clear_stale_tmp() { *kwin* | *plasmashell*) ;; *) names+=(-o \( -type d -empty -name 'plasma-csd-generator.??????' \)) ;; esac + case $running in + *kwin* | *Xwayland* | *Xorg* | *Xvfb* | *Xvnc* | *gamescope*) ;; + *) names+=(-o \( -type f -name '.X[0-9]*-lock' \)) ;; + esac [ ${#names[@]} -gt 0 ] || return 0 n=$(find /tmp -mindepth 1 -maxdepth 1 \( "${names[@]:1}" \) -print -exec rm -rf {} + 2>/dev/null | wc -l) [ "$n" -gt 0 ] && echo "== /tmp: cleared $n entries earlier sessions left" diff --git a/tools/tests/test_session_tmp.py b/tools/tests/test_session_tmp.py index 55caf42780..4105c31319 100644 --- a/tools/tests/test_session_tmp.py +++ b/tools/tests/test_session_tmp.py @@ -14,10 +14,11 @@ CHROMIUM = ["scoped_dir3yu9Xt/SingletonSocket"] APPIMAGE = ["droiddeck-appimage.19PoOD"] BUS = ["dbus-1zWfOP1IaR="] KDE = ["plasma-csd-generator.BVWIWA/"] -STALE = STEAM + CHROMIUM + APPIMAGE + BUS + KDE +XLOCK = [".X0-lock", ".X1-lock"] +STALE = STEAM + CHROMIUM + APPIMAGE + BUS + KDE + XLOCK KEPT = ["droiddeck-mangohud.conf", ".X11-unix/", "steamworks", "steamABCDEF/inside", "notes.txt", "mangohud.conf", ".wine-10480/", "dbus-1zWfOP1IaR.log", "dbus-notasocket", - "plasma-csd-generator.CQGZSw/kept"] + "plasma-csd-generator.CQGZSw/kept", ".X11-unix/X1", ".Xauthority"] def sweep_function(tmp): @@ -57,7 +58,7 @@ class SessionTmpTest(unittest.TestCase): return os.path.lexists(self.tmp / name.rstrip("=").split("/")[0]) def test_what_killed_sessions_left_goes_and_nothing_else(self): - self.assertEqual("== /tmp: cleared 8 entries earlier sessions left\n", self.sweep()) + self.assertEqual("== /tmp: cleared 10 entries earlier sessions left\n", self.sweep()) for name in STALE: self.assertFalse(self.exists(name), name) for name in KEPT: @@ -84,7 +85,13 @@ class SessionTmpTest(unittest.TestCase): self.kept_while("55 dbus-daemon --config-file=/usr/local/share/droiddeck/system-bus.conf --nofork\n", []) def test_a_running_desktop_keeps_its_decorations(self): - self.kept_while("44 kwin_wayland --xwayland\n", KDE) + self.kept_while("44 kwin_wayland --xwayland\n", KDE + XLOCK) + + def test_a_running_x_server_keeps_its_display_lock(self): + self.kept_while("33 /usr/bin/Xwayland :1 -rootless -core -listenfd 41\n", XLOCK) + + def test_a_running_gamescope_keeps_its_display_locks(self): + self.kept_while("22 gamescope --backend wayland --xwayland-count 2 -- droiddeck-session steam\n", XLOCK) def test_a_clean_tmp_says_nothing(self): self.sweep()