Desktop Notification Hook
Sends a native desktop notification whenever Claude Code needs your input or attention. Works on macOS (osascript) and Linux (notify-send). Never miss a permission prompt or question while multitasking.
Hook Type
Notification -- Fires when Claude Code needs user attention (permission requests, questions, task completion).
Description
This hook sends a native OS desktop notification so you can context-switch away from the terminal and still be alerted when Claude needs input. Supports macOS and Linux out of the box.
Patterns/Rules
- Triggers on all notification events (empty matcher = match everything)
- Uses
osascripton macOS for native Notification Center integration - Uses
notify-sendon Linux for freedesktop notifications - Zero dependencies on macOS; requires
libnotifyon Linux
Configuration
macOS
{ "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\" sound name \"Ping\"'" } ] } ] } }
Linux
{ "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "notify-send 'Claude Code' 'Claude Code needs your attention' --urgency=normal --icon=terminal" } ] } ] } }
Cross-Platform (auto-detect)
{ "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "if [ \"$(uname)\" = \"Darwin\" ]; then osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\" sound name \"Ping\"'; else notify-send 'Claude Code' 'Claude Code needs your attention' --urgency=normal 2>/dev/null || true; fi" } ] } ] } }
Action
When the Notification event fires, the hook executes the OS-specific notification command. The notification appears in your system tray / notification center with the title "Claude Code".
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Pre-Commit Security Scanner
Pre-commit hook that scans staged files for hardcoded secrets, API keys, passwords, and sensitive data patterns before allowing commits.
Agents Md Watcher
Streamline your workflow with this automatically, loads, agents, configuration. Includes structured workflows, validation checks, and reusable patterns for automation.
Automated Build Inspector
Boost productivity using this automatically, trigger, build, processes. Includes structured workflows, validation checks, and reusable patterns for automation.