From db5df263b2280ceeebb198c7e27caf977dac434d Mon Sep 17 00:00:00 2001 From: Miguel Palhas Date: Fri, 18 Sep 2026 11:04:20 +0100 Subject: [PATCH] fix(gaming): stop hypridle while a stream is connected Gamepad input comes in on a uinput joystick, which is not part of the wl_seat, so it never resets Hyprland's idle notifier. Controller-only play read as idle and the 900s listener locked mid-game. The dbus inhibitor cannot help here because hypridle runs with ignore_dbus_inhibit = true. Co-Authored-By: Claude --- .../programs/gaming/sunshine-session-lock.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/home/common/programs/gaming/sunshine-session-lock.nix b/home/common/programs/gaming/sunshine-session-lock.nix index 6566f6a..ec0207c 100644 --- a/home/common/programs/gaming/sunshine-session-lock.nix +++ b/home/common/programs/gaming/sunshine-session-lock.nix @@ -43,7 +43,10 @@ let pkgs.procps ]; text = '' - stamp="''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}/sunshine-session-unlocked" + # systemctl --user reaches the session manager through $XDG_RUNTIME_DIR/bus; + # sunshine's environment does not always carry the variable. + export XDG_RUNTIME_DIR="''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" + stamp="$XDG_RUNTIME_DIR/sunshine-session-unlocked" # The graphical seat session — NOT the `manager` session that the sunshine # user service itself runs in. Sunshine's environment carries no @@ -63,6 +66,14 @@ let case "''${1:-}" in unlock) + # Gamepad input arrives on a uinput joystick, which is not part of the + # wl_seat, so it never resets Hyprland's idle notifier: controller-only + # play looks idle and the 900s listener locks mid-game. The dbus + # inhibitor cannot prevent this either, because hypridle runs with + # ignore_dbus_inhibit = true (see hyprland/default.nix). Stopping the + # daemon for the life of the stream is the only lever left. + systemctl --user stop hypridle || true + # No hyprlock running means the session was already unlocked: do # nothing, and leave no stamp so `lock` won't lock it on the way out. if pkill -u "$(id -u)" -USR1 -x hyprlock; then @@ -71,6 +82,10 @@ let ;; lock) + # Before the stamp check: idle timers must come back even when the + # stream arrived at an already-unlocked session and left no stamp. + systemctl --user start hypridle || true + [ -e "$stamp" ] || exit 0 rm -f "$stamp" s="$(graphical_session)" || exit 0