simple-notifications — Claude Code hook: what it does, how to install
Sends desktop notifications on macOS and Linux whenever Claude Code finishes a task or requires user attention.
npx claude-code-templates@latest --hook automation/simple-notificationsWhat simple-notifications does
This hook registers handlers for two events in Claude Code: Stop and Notification. It triggers a desktop notification when execution finishes. If Claude Code pauses for user confirmation or input, it fires a separate alert.
Under the hood, the hook executes shell commands tailored to the operating system. On macOS, it relies on osascript and plays a Ping sound when user input is needed. On Linux, it routes alerts to notify-send, assigning the -u critical flag to input requests.
Without osascript on macOS or notify-send on Linux, the commands do nothing because the shell logic checks for these binaries before firing. Settings are stored directly in .claude/settings.json.
What it helps with
- receive a desktop alert when Claude Code finishes working
- get notified with a Ping sound whenever Claude Code asks for input on macOS
- display a critical notification via
notify-sendon Linux systems
Example prompts for the agent
- Run the full test suite and notify me when you are done
- Analyze project dependencies and pause for my confirmation before updating
How to install simple-notifications
1claude-code-templates
npx claude-code-templates@latest --hook automation/simple-notifications2Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about simple-notifications
How to install simple-notifications in Claude Code?
Run npx claude-code-templates@latest --hook automation/simple-notifications. This adds the hook configuration directly to .claude/settings.json.
What does the simple-notifications hook do?
It triggers desktop alerts on macOS and Linux when Claude Code finishes a task or pauses for input.
Which system utilities are required for notifications to work?
On macOS, the hook relies on built-in osascript with a Ping audio alert. On Linux, it requires the notify-send utility to display critical alerts.
Source text
simple-notifications.json · MIT
{
"description": "Send desktop notifications when Claude Code finishes working or needs user input. Works on macOS and Linux systems.",
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "if command -v osascript >/dev/null 2>&1; then osascript -e 'display notification \"Claude has finished working\" with title \"Claude Code\"'; elif command -v notify-send >/dev/null 2>&1; then notify-send 'Claude Code' \"Claude has finished working\"; fi"
}
]
}
],
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "if command -v osascript >/dev/null 2>&1; then osascript -e 'display notification \"Claude needs your input\" with title \"Claude Code\" sound name \"Ping\"'; elif command -v notify-send >/dev/null 2>&1; then notify-send -u critical 'Claude Code' \"Claude needs your input\"; fi"
}
]
}
]
}
}
© davila7 · MIT · davila7/claude-code-templates