From eb81546609a1decc8e8ac4bc3856b6b17269777d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 16 Nov 2026 17:20:29 +0100 Subject: fix(status): statusctl watch counts status.xbox as gaming The shell ORs status.xbox into presentation, so the CLI reads it too: the watch emits the gaming class and toggle is refused while the Xbox runs a game, as for a PC game. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/status/statusctl | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'desktop/modules/status/statusctl') diff --git a/desktop/modules/status/statusctl b/desktop/modules/status/statusctl index 7bbae3e..69dc5a1 100755 --- a/desktop/modules/status/statusctl +++ b/desktop/modules/status/statusctl @@ -83,17 +83,22 @@ tooltip() { case "$1" in activated) printf '%s: on' "$mode" ;; deactivated) printf '%s: off' "$mode" ;; - gaming) printf '%s: on (auto: game or call)' "$mode" ;; + gaming) printf '%s: on (auto: game, call or Xbox)' "$mode" ;; esac } -# The shell's game detector owns status.gaming and presentation is the OR of -# the two, so the CLI has to read it to agree with the shell. It is not a mode -# in MODES: nothing here may write it, and only presentation is affected. +# The shell's game detector owns status.gaming, deck-it owns status.xbox (a +# game on the Xbox), and presentation is the OR of them and its own file, so +# the CLI has to read both to agree with the shell. Neither is a mode in +# MODES: nothing here may write them, and only presentation is affected. gaming_on() { - local v="" - [[ -e "$DIR/status.gaming" ]] && v="$(tr -d '[:space:]' < "$DIR/status.gaming" 2>/dev/null)" - [[ "$v" == "1" ]] + local f v + for f in status.gaming status.xbox; do + v="" + [[ -e "$DIR/$f" ]] && v="$(tr -d '[:space:]' < "$DIR/$f" 2>/dev/null)" + [[ "$v" == "1" ]] && return 0 + done + return 1 } # A missing file is the off state, not a distinct condition: read_mode already @@ -158,14 +163,14 @@ case "$action" in exec 3< <(inotifywait -q -m -e create,close_write,moved_to,delete --format '%f' "$DIR" 2>/dev/null) watcher=$! trap 'kill "$watcher" 2>/dev/null' EXIT TERM INT - # Presentation also follows status.gaming, so a game starting or - # ending redraws the widget. Emitting only on a real change keeps a + # Presentation also follows status.gaming and status.xbox, so a game + # starting or ending redraws the widget. Emitting only on a real change keeps a # write of an unchanged value from firing a duplicate line. last="$(state_now)" while read -r changed <&3; do case "$changed" in "status.$mode") ;; - status.gaming) [[ "$mode" == "presentation" ]] || continue ;; + status.gaming|status.xbox) [[ "$mode" == "presentation" ]] || continue ;; *) continue ;; esac now="$(state_now)" -- cgit v1.2.3