aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/status/statusctl
diff options
context:
space:
mode:
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)"