Skip to content

Latest commit

 

History

History
137 lines (116 loc) · 3.26 KB

File metadata and controls

137 lines (116 loc) · 3.26 KB

Claude Code Notification Hook for Windows

Demo

A PowerShell script that displays Windows Toast notifications for Claude Code hook events.

Zero dependency - Uses only built-in Windows APIs and PowerShell.

Installation

  1. Download the script:
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/soulee-dev/claude-code-notify-powershell/main/claude-hook-toast.ps1" -OutFile "$env:USERPROFILE\.claude\claude-hook-toast.ps1"
  1. Add to ~/.claude/settings.json:
{
  "hooks": {
    "Notification": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ]
  }
}
More notifications (SessionStart, SessionEnd, PermissionRequest)
{
  "hooks": {
    "Notification": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ],
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ],
    "SessionEnd": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ],
    "PermissionRequest": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cmd /c chcp 65001 >nul && powershell -ExecutionPolicy Bypass -File %USERPROFILE%\\.claude\\claude-hook-toast.ps1"
          }
        ]
      }
    ]
  }
}

For more hook events, see the Claude Code Hooks Guide.

Usage

The script automatically receives hook events from Claude Code and displays them as Windows toast notifications.

Event Types

Event Message
SessionStart Session started
SessionEnd Session completed
Stop Response finished
Notification Custom message from Claude Code

Customization

Edit the switch block in the script to customize messages:

$message = switch ($hookEvent) {
    "SessionStart"  { "Your custom message" }
    "SessionEnd"    { "Your custom message" }
    # ...
}

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.