Skip to main content
hook

desktop-notification-on-stop — Claude Code hook: install

This hook sends a desktop alert when Claude Code finishes a response. Use it to catch the handoff while working in another window.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --hook monitoring/desktop-notification-on-stop
Open on GitHub

What desktop-notification-on-stop does

The hook runs on the Stop event and sends one notification when Claude Code finishes its response. It does not alert after every tool call; the trigger is response completion rather than PostToolUse.

On macOS, it sends the alert with osascript; on Linux, it uses notify-send. The command checks for these utilities and picks the first one it finds. Without either utility, no desktop alert is sent.

Install it with npx claude-code-templates@latest --hook monitoring/desktop-notification-on-stop; the hook settings go in .claude/settings.json. The notification method therefore depends on which system utility is available on your OS.

What it helps with

  • get an alert when Claude Code finishes a response
  • notice when Claude Code is ready while viewing another window
  • avoid alerts after each tool call

Example prompts for the agent

  • Review this module and tell me what should change.
  • Write tests for src/parser.ts and explain the result.
  • Find the cause of the error in app.log and suggest a fix.

How to install desktop-notification-on-stop

1claude-code-templates

npx claude-code-templates@latest --hook monitoring/desktop-notification-on-stop

2Manually: put the files in place

.claude/settings.json

The 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 desktop-notification-on-stop

How do I install desktop-notification-on-stop in Claude Code?

Run npx claude-code-templates@latest --hook monitoring/desktop-notification-on-stop. The hook settings are in .claude/settings.json.

What does desktop-notification-on-stop do?

It sends a desktop notification when Claude Code finishes a response. The hook listens for Stop, rather than firing after each tool call.

Which operating systems does desktop-notification-on-stop support?

It uses osascript on macOS and notify-send on Linux. If neither utility is available, it cannot send the notification.

Source text

desktop-notification-on-stop.json · MIT
{
  "description": "Sends a native desktop notification when Claude Code finishes responding. Uses the Stop hook event so you get a single notification per response instead of one per tool call (which is very noisy with PostToolUse). Supports macOS (osascript) and Linux (notify-send). Useful when you switch to another window while Claude works — you'll get a notification when it's ready for your input.",
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "if command -v osascript >/dev/null 2>&1; then osascript -e 'display notification \"Response complete\" with title \"Claude Code\"'; elif command -v notify-send >/dev/null 2>&1; then notify-send 'Claude Code' 'Response complete'; fi"
          }
        ]
      }
    ]
  }
}

© davila7 · MIT · davila7/claude-code-templates

Similar hooks

All hooks for DevOps and infrastructure →

From the same set740

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor