{"slug": "get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook", "title": "Get a desktop ping when Claude Code is waiting on you, with a Notification hook", "summary": "A developer published a Claude Code Notification hook that fires a desktop alert via osascript or notify-send whenever the agent pauses for a permission prompt or idle input, preventing long tasks from stalling unnoticed. The hook reads a JSON payload from stdin, extracts the message field with a short Python one-liner, and is registered under the Notification key in .claude/settings.json, exiting 0 so it never blocks the session.", "body_md": "You kick off a long Claude Code task, switch to another window, and come back twenty minutes later to find it stopped after two minutes, waiting for you to approve one command.\n\nA `Notification` hook fixes that. Claude Code fires it when it needs your attention, such as a permission prompt or an idle wait for input, and the hook receives a small JSON payload on stdin with a `message` field.\n\nSave as `.claude/hooks/notify.sh` and `chmod +x` it:\n\n``` bash\n#!/usr/bin/env bash\n# notify.sh: desktop ping when Claude Code needs you\nset -uo pipefail\nmsg=$(python3 -c 'import sys,json; print(json.load(sys.stdin).get(\"message\",\"Claude Code needs you\"))' 2>/dev/null || echo \"Claude Code needs you\")\nif command -v osascript >/dev/null; then\n  osascript -e \"display notification \\\"${msg//\\\"/}\\\" with title \\\"Claude Code\\\"\"\nelif command -v notify-send >/dev/null; then\n  notify-send \"Claude Code\" \"$msg\"\nelse\n  printf '\\a'  # terminal bell as a last resort\nfi\nexit 0\n```\n\nIn `.claude/settings.json`:\n\n```\n{\n  \"hooks\": {\n    \"Notification\": [\n      {\n        \"hooks\": [\n          { \"type\": \"command\", \"command\": \".claude/hooks/notify.sh\" }\n        ]\n      }\n    ]\n  }\n}\n```\n\nCheck the hooks page for your installed Claude Code version; payload fields and matcher options can change between releases.\n\n`exit 0`. A notification hook should never block the session.` settings.json`, so you get pinged for decisions that matter, not for every `ls`.\nI keep this hook alongside the allow-list, the safety hooks, and a short house-rules file in [Vildanden Agent Config](https://justly-mia-429.rehost.page/). The free sample has enough to try the pattern today.", "url": "https://wpnews.pro/news/get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook", "canonical_source": "https://dev.to/vildandenai/get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook-4i4j", "published_at": "2026-10-19 01:08:01+00:00", "updated_at": "2026-10-19 01:18:53.667922+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "Anthropic"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook", "markdown": "https://wpnews.pro/news/get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook.md", "text": "https://wpnews.pro/news/get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook.txt", "jsonld": "https://wpnews.pro/news/get-a-desktop-ping-when-claude-code-is-waiting-on-you-with-a-notification-hook.jsonld"}}