diff options
Diffstat (limited to 'desktop/modules/status/test-notify-sound.sh')
| -rwxr-xr-x | desktop/modules/status/test-notify-sound.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/desktop/modules/status/test-notify-sound.sh b/desktop/modules/status/test-notify-sound.sh index 9571d4c..d70893f 100755 --- a/desktop/modules/status/test-notify-sound.sh +++ b/desktop/modules/status/test-notify-sound.sh @@ -13,7 +13,8 @@ # # The one runnable check for notify-sound. A fake paplay first on PATH # records what it was asked to play, and XDG_RUNTIME_DIR is a temporary -# directory, so no sound plays and the live quiet mode is untouched. +# directory, so no sound plays and the live quiet mode is untouched. A fake +# agent-lamp records its arguments, so the real lamp is never driven. # # Usage: ./test-notify-sound.sh (exit 0 = all passed) @@ -27,6 +28,8 @@ export NOTIFY_SOUND_DIR="/sounds" mkdir "$tmp/bin" printf '#!/bin/sh\nprintf "%%s\\n" "$1" >> "%s/played"\n' "$tmp" > "$tmp/bin/paplay" chmod +x "$tmp/bin/paplay" +printf '#!/bin/sh\nprintf "%%s %%s\\n" "$1" "$2" >> "%s/lamp"\n' "$tmp" > "$tmp/bin/agent-lamp" +chmod +x "$tmp/bin/agent-lamp" export PATH="$tmp/bin:$PATH" pass=0 @@ -64,5 +67,15 @@ check "quiet mutes permission" "" "$(play permission)" "$here/statusctl" quiet set 0 check "quiet off plays again" "/sounds/claude-attention.opus" "$(play claude)" +# Two arguments (opencode's event and session) are forwarded to agent-lamp, +# even in quiet mode; Claude's single argument never is. +rm -f "$tmp/lamp" +"$here/notify-sound" claude +"$here/notify-sound" permission ses1 +"$here/statusctl" quiet set 1 +"$here/notify-sound" complete ses2 +sleep 0.2 +check "lamp forward" "permission ses1|complete ses2" "$(paste -sd'|' "$tmp/lamp" 2>/dev/null)" + printf '\n%d passed, %d failed\n' "$pass" "$fail" [[ "$fail" -eq 0 ]] |
