From 98fc6036ee817a92810e060c80d48aa6a936a1ab Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 15 Oct 2026 11:25:50 +0200 Subject: feat(status): quiet mode mutes the Claude and opencode sounds A new registry mode, status.quiet, with a row on the status page. Both tools will play their sounds through notify-sound, which asks statusctl and plays nothing while quiet is on, so their popups stay and only the sound goes. Presentation sets quiet and restores it afterwards, like dnd and nolock: a sound during a call or a game is what quiet is for. notify-sound ignores any argument it has no sound for, because the opencode notifier runs its command on every event, session_started and user_message included. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/status/notify-sound | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 desktop/modules/status/notify-sound (limited to 'desktop/modules/status/notify-sound') diff --git a/desktop/modules/status/notify-sound b/desktop/modules/status/notify-sound new file mode 100755 index 0000000..c028b3e --- /dev/null +++ b/desktop/modules/status/notify-sound @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# The one place Claude and opencode play their sounds, so quiet mode can +# silence both. Their popups do not come through here and are unaffected. +# +# notify-sound claude Claude Code's Notification hook +# notify-sound the notifier's command hook +# +# An argument with no sound plays nothing. That is deliberate: the opencode +# notifier runs its command for every event, session_started and +# user_message included, and only four of them ever made a sound. + +set -u + +here="$(dirname "$(readlink -f "$0")")" +[[ "$("$here/statusctl" quiet get)" == "1" ]] && exit 0 + +dir="${NOTIFY_SOUND_DIR:-$HOME/Music/notify}" + +case "${1:-}" in + claude) file="claude-attention.opus" ;; + permission) file="opencode-perms.opus" ;; + complete|error|question) file="opencode-attention.opus" ;; + *) exit 0 ;; +esac + +exec paplay "$dir/$file" 2>/dev/null -- cgit v1.2.3