Skip to content

Instantly share code, notes, and snippets.

@adam-binks
Created February 20, 2026 13:27
Show Gist options
  • Select an option

  • Save adam-binks/c1896827172e2a17058201282dcca245 to your computer and use it in GitHub Desktop.

Select an option

Save adam-binks/c1896827172e2a17058201282dcca245 to your computer and use it in GitHub Desktop.
Spatial audio notifications for Claude Code — plays a sound when tasks complete or permissions are needed, panned to match which monitor your terminal is on
#!/bin/bash
# Simple Claude Code notification sounds
# Claude Code passes event info as JSON on stdin
EVENT=$(cat | jq -r '.hook_event_name // empty' 2>/dev/null)
VOLUME=0.6
# Determine which sound to play
case "$EVENT" in
Stop|Notification)
SOUND=/System/Library/Sounds/Pop.aiff
;;
PermissionRequest)
SOUND=/System/Library/Sounds/Glass.aiff
;;
*)
exit 0
;;
esac
# Check if Cursor window is on the second (left) monitor
CURSOR_X=$(osascript -e 'tell application "System Events" to tell process "Cursor" to get item 1 of (get position of window 1)' 2>/dev/null)
if [ -n "$CURSOR_X" ] && [ "$CURSOR_X" -lt 0 ] 2>/dev/null; then
# Second monitor (left) — pan left
/opt/homebrew/bin/play -v "$VOLUME" "$SOUND" remix 1v1 1v0 &
else
# Main monitor — center
afplay -v "$VOLUME" "$SOUND" &
fi
// Add this to your ~/.claude/settings.json under "hooks":
// Requires: brew install sox, jq
// Requires: macOS Accessibility permission for your terminal app
//
// Customize: change VOLUME, SOUND files, or the monitor detection logic in play.sh
// Available macOS sounds: ls /System/Library/Sounds/
{
"Stop": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/sounds/play.sh", "timeout": 5, "async": true }]
}
],
"Notification": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/sounds/play.sh", "timeout": 5, "async": true }]
}
],
"PermissionRequest": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/sounds/play.sh", "timeout": 5, "async": true }]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment