diff --git a/slab/bin/claude-notify.sh b/slab/bin/claude-notify.sh --- a/slab/bin/claude-notify.sh +++ b/slab/bin/claude-notify.sh @@ -38,6 +38,13 @@ # set the pause flag above and want it to persist until UserPromptSubmit # or Stop clears it. "$SLAB_BIN/slab-fade-ambient" +# Honor the menubar's "Mute ambient sonification" toggle — skip the +# "help me" TTS while muted. The pause flag and awaiting marker above +# still get set so the menubar / daemon stay accurate. +if [[ -e "$SLAB_HOME/state/muted" ]]; then + exit 0 +fi + py="$SLAB_HOME/venv/bin/python3" helper="$SLAB_BIN/claude-help.py" if [[ -x "$py" && -f "$helper" ]]; then diff --git a/slab/bin/claude-subagent-stop.sh b/slab/bin/claude-subagent-stop.sh --- a/slab/bin/claude-subagent-stop.sh +++ b/slab/bin/claude-subagent-stop.sh @@ -7,10 +7,17 @@ SLAB_HOME=${SLAB_HOME:-$HOME/.local/share/slab} SLAB_BIN=${SLAB_BIN:-$HOME/.local/bin} SUBAGENT_DIR="$SLAB_HOME/state/active-subagents" SOUNDS="$SLAB_HOME/sounds" +MUTE_FLAG="$SLAB_HOME/state/muted" mkdir -p "$SUBAGENT_DIR" oldest=$(ls -1tr "$SUBAGENT_DIR" 2>/dev/null | head -1) [[ -n "$oldest" ]] && rm -f "$SUBAGENT_DIR/$oldest" + +# Honor the menubar's "Mute ambient sonification" toggle — no ping / TTS +# while muted. Marker accounting above still runs so counts stay correct. +if [[ -e "$MUTE_FLAG" ]]; then + exit 0 +fi py="$SLAB_HOME/venv/bin/python3" helper="$SLAB_BIN/jeffrey-say.py" diff --git a/slab/bin/lid-ambient.sh b/slab/bin/lid-ambient.sh --- a/slab/bin/lid-ambient.sh +++ b/slab/bin/lid-ambient.sh @@ -27,6 +27,9 @@ # Set by claude-notify.sh when the agent pauses for user feedback. While # present, ambient stays off even though an active marker exists. Cleared by # claude-prompt-log.sh (user responded) or claude-stop.sh (work ended). AMBIENT_PAUSE_FLAG=/tmp/slab-ambient-paused +# Persistent mute flag toggled by the menubar's "Mute ambient sonification" +# item. When present, ambient never starts and any in-flight pad is faded. +MUTE_FLAG="$SLAB_HOME/state/muted" ACTIVE_DIR="$SLAB_HOME/state/active-prompts" SUBAGENT_DIR="$SLAB_HOME/state/active-subagents" @@ -175,9 +178,10 @@ fi fi # Ambient gate: lid closed + sleep disabled + active prompt or subagent, - # and NOT paused-for-feedback by a Notification hook. + # and NOT paused-for-feedback by a Notification hook, and NOT muted + # via the menubar's "Mute ambient sonification" toggle. ambient_wanted=0 - if [[ "$lid_state" == "Yes" && "$sleep_disabled" == "1" ]] && (( active_count > 0 )) && [[ ! -f "$AMBIENT_PAUSE_FLAG" ]]; then + if [[ "$lid_state" == "Yes" && "$sleep_disabled" == "1" ]] && (( active_count > 0 )) && [[ ! -f "$AMBIENT_PAUSE_FLAG" ]] && [[ ! -f "$MUTE_FLAG" ]]; then ambient_wanted=1 fi