]> git.ekhem.eu.org Git - guix.git/commitdiff
[home] Add desktop notification hooks for Claude Code.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 21 Jun 2026 13:43:30 +0000 (15:43 +0200)
committerJakub Czajka <jakub@ekhem.eu.org>
Wed, 24 Jun 2026 22:53:20 +0000 (00:53 +0200)
Send dunstify notifications on permission_prompt and idle_prompt
events via a shell script alongside the existing guix-check hook.
Uses a single Notification matcher entry in project settings.json
referenced via CLAUDE_PROJECT_DIR.

Co-Authored-By: Claude <noreply@anthropic.com>
.claude/hooks/notify [new file with mode: 0755]
.claude/settings.json

diff --git a/.claude/hooks/notify b/.claude/hooks/notify
new file mode 100755 (executable)
index 0000000..4a9ef55
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Copyright (c) 2026 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+#
+# notify — send a desktop notification for Claude Code events.
+
+type=$(sed -n \
+  's/.*"notification_type":"\([^"]*\)".*/\1/p')
+case "$type" in
+  permission_prompt)
+    body="🤖🔐 Needs Approval"
+    ;;
+  idle_prompt)
+    body="🤖✅ Finished"
+    ;;
+  *)
+    exit 0
+    ;;
+esac
+
+$HOME/.guix-home/profile/bin/dunstify \
+  --urgency normal \
+  --timeout 10000 \
+  --appname "Claude Code" \
+  "Claude Code" \
+  "$body"
index 4a8d302bdb53d9d08852b5e99c5854fbe8c429eb..d15a65932ec3ab0a4d4c5c89bea5296aa69085e4 100644 (file)
           }
         ]
       }
+    ],
+    "Notification": [
+      {
+        "matcher": "permission_prompt|idle_prompt",
+        "hooks": [
+          {
+            "type": "command",
+            "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/notify",
+            "async": true
+          }
+        ]
+      }
     ]
   }
 }