cd /news/ai-agents/get-a-desktop-ping-when-claude-code-… · home › topics › ai-agents › article
[ARTICLE · art-152584] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Get a desktop ping when Claude Code is waiting on you, with a Notification hook

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.

by read1 min views2 publishedOct 19, 2026

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.

A 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.

Save as .claude/hooks/notify.sh and chmod +x it:

#!/usr/bin/env bash
set -uo pipefail
msg=$(python3 -c 'import sys,json; print(json.load(sys.stdin).get("message","Claude Code needs you"))' 2>/dev/null || echo "Claude Code needs you")
if command -v osascript >/dev/null; then
  osascript -e "display notification \"${msg//\"/}\" with title \"Claude Code\""
elif command -v notify-send >/dev/null; then
  notify-send "Claude Code" "$msg"
else
  printf '\a'  # terminal bell as a last resort
fi
exit 0

In .claude/settings.json:

{
  "hooks": {
    "Notification": [
      {
        "hooks": [
          { "type": "command", "command": ".claude/hooks/notify.sh" }
        ]
      }
    ]
  }
}

Check the hooks page for your installed Claude Code version; payload fields and matcher options can change between releases.

exit 0. A notification hook should never block the session. settings.json, so you get pinged for decisions that matter, not for every ls. I keep this hook alongside the allow-list, the safety hooks, and a short house-rules file in Vildanden Agent Config. The free sample has enough to try the pattern today.

── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/get-a-desktop-ping-w…] indexed:0 read:1min 2026-10-19 · —