-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathclaude-hook-toast.ps1
More file actions
20 lines (18 loc) · 1.02 KB
/
claude-hook-toast.ps1
File metadata and controls
20 lines (18 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Claude Code Notification Hook Script (Windows PowerShell)
$json = ($input | Out-String) | ConvertFrom-Json -ErrorAction SilentlyContinue
$hookEvent = $json.hook_event_name
$message = switch ($hookEvent) {
"SessionStart" { "Session started" }
"SessionEnd" { "Session completed" }
"Stop" { "Response finished" }
"Notification" { $json.message }
default { "$hookEvent : $($json.message)" }
}
# Windows Toast Notification
$template = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]::GetTemplateContent(
[Windows.UI.Notifications.ToastTemplateType, Windows.UI.Notifications, ContentType = WindowsRuntime]::ToastText02
)
$template.SelectSingleNode('//text[@id="1"]').InnerText = "Claude Code"
$template.SelectSingleNode('//text[@id="2"]').InnerText = $message
$appId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($appId).Show($template)