Back to Hooks

Desktop Notification

Stop

Send a desktop notification when Claude Code finishes a task

notificationproductivitymacos
By Claude Code Community

Hook Script

#!/bin/bash
# Desktop Notification Hook
# Sends a notification when Claude Code stops

# macOS notification
if command -v osascript &> /dev/null; then
  osascript -e 'display notification "Claude Code has finished the task" with title "Claude Code"'
fi

# Linux notification (if notify-send is available)
if command -v notify-send &> /dev/null; then
  notify-send "Claude Code" "Claude Code has finished the task"
fi

Settings Configuration

{
  "hooks": {
    "Stop": [
      {
        "command": "./hooks/notify-on-complete.sh"
      }
    ]
  }
}

How to use

  1. Create a hooks directory in your project: mkdir hooks
  2. Save the hook script as hooks/notify-on-complete.sh
  3. Make it executable: chmod +x hooks/notify-on-complete.sh
  4. Add the configuration to your Claude Code settings
  5. Restart Claude Code to apply changes