Last active
February 25, 2026 03:34
-
-
Save andrewvaughan/40f267e3161c5a7c10f3efec4d02bcdf to your computer and use it in GitHub Desktop.
Claude Code macOS notifications via hooks (permission prompts, questions, and completion)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| INPUT="$(cat)" | |
| # Skip if this is a subagent stopping, not the main agent | |
| AGENT_ID="$(echo "$INPUT" | jq -r '.agent_id // empty')" | |
| if [[ -n "$AGENT_ID" ]]; then | |
| exit 0 | |
| fi | |
| CWD="$(echo "$INPUT" | jq -r '.cwd // ""')" | |
| PROJECT="$(basename "$CWD")" | |
| terminal-notifier \ | |
| -title "Claude Code — $PROJECT" \ | |
| -message "Done" \ | |
| -sound Glass >/dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -eo pipefail | |
| INPUT="$(cat)" | |
| CWD="$(echo "$INPUT" | jq -r '.cwd // ""')" | |
| PROJECT="$(basename "$CWD")" | |
| terminal-notifier \ | |
| -title "Claude Code — $PROJECT" \ | |
| -message "Claude is asking a question" \ | |
| -sound Glass >/dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -eo pipefail | |
| INPUT="$(cat)" | |
| CWD="$(echo "$INPUT" | jq -r '.cwd // ""')" | |
| PROJECT="$(basename "$CWD")" | |
| MESSAGE="$(echo "$INPUT" | jq -r '.message // "Waiting for permission"')" | |
| terminal-notifier \ | |
| -title "Claude Code — $PROJECT" \ | |
| -message "$MESSAGE" \ | |
| -sound Glass >/dev/null 2>&1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "permissions": { | |
| "allow": [] | |
| }, | |
| "hooks": { | |
| "PreToolUse": [ | |
| { | |
| "matcher": "AskUserQuestion", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "~/.claude/hooks/notify-needs-attention.sh" | |
| } | |
| ] | |
| } | |
| ], | |
| "Notification": [ | |
| { | |
| "matcher": "permission_prompt", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "~/.claude/hooks/notify-permission.sh" | |
| } | |
| ] | |
| } | |
| ], | |
| "PermissionRequest": [ | |
| { | |
| "matcher": "", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "~/.claude/hooks/notify-permission.sh" | |
| } | |
| ] | |
| } | |
| ], | |
| "Stop": [ | |
| { | |
| "matcher": "", | |
| "hooks": [ | |
| { | |
| "type": "command", | |
| "command": "~/.claude/hooks/notify-done.sh" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment