aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/status/statusctl
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-16 17:20:29 +0100
committerDanilo M. <danix@danix.xyz>2026-11-16 17:20:29 +0100
commiteb81546609a1decc8e8ac4bc3856b6b17269777d (patch)
tree7e5091b8103554d4da72a49e9ff7dbb5e2a90878 /desktop/modules/status/statusctl
parent6d60c2a0af28afd8bde3fc41c92f759e10845221 (diff)
downloadquickshell-master.tar.gz
quickshell-master.zip
fix(status): statusctl watch counts status.xbox as gamingHEADmaster
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/status/statusctl')
-rwxr-xr-xdesktop/modules/status/statusctl25
1 files changed, 15 insertions, 10 deletions
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)"