Skip to content

Instantly share code, notes, and snippets.

@orlenko
Created June 16, 2026 23:41
Show Gist options
  • Select an option

  • Save orlenko/bc4e8b2eceb8a03dc1537e8a598289a2 to your computer and use it in GitHub Desktop.

Select an option

Save orlenko/bc4e8b2eceb8a03dc1537e8a598289a2 to your computer and use it in GitHub Desktop.
Voice mute/unmute for claude stop voice hook
#!/bin/bash
# voice β€” control the Claude Code voice-stop hook.
# Presence of ~/.claude/voice.muted disables spoken output; muted turns
# pop a macOS notification with the same text instead.
set -e
FLAG="$HOME/.claude/voice.muted"
cmd="${1:-status}"
print_status() {
if [ -f "$FLAG" ]; then
echo "πŸ”‡ muted (notifications still shown)"
else
echo "πŸ”Š unmuted"
fi
}
case "$cmd" in
mute|off)
mkdir -p "$(dirname "$FLAG")"
touch "$FLAG"
print_status
;;
unmute|on)
rm -f "$FLAG"
print_status
;;
toggle)
if [ -f "$FLAG" ]; then
rm -f "$FLAG"
else
mkdir -p "$(dirname "$FLAG")"
touch "$FLAG"
fi
print_status
;;
status|"")
print_status
;;
-h|--help|help)
cat <<'EOF'
voice β€” mute/unmute the Claude Code voice hook
usage:
voice show current state
voice status show current state
voice mute silence voice; still pops macOS notifications
voice unmute restore voice
voice toggle flip current state
state file: ~/.claude/voice.muted
hook: ~/.claude/hooks/voice-stop.sh
EOF
;;
*)
echo "voice: unknown command '$cmd' (try: voice help)" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment