Simple Notifications Hook(Claude Code)

Simple Notifications Hook 会在 Claude Code 完成工具执行后发送桌面通知,适合处理长任务时的提醒与节奏管理。
主要功能(Key Capabilities)
- Instant Notifications(操作完成立即提醒)
- Cross-Platform(macOS / Linux)
- PostToolUse Hook(自动触发)
- Universal Matcher(默认覆盖所有工具)
- Lightweight(零负担)
安装(Installation)
npx claude-code-templates@latest --hook automation/simple-notifications
安装路径:
your-project/
├── .claude/
│ └── hooks/
│ └── simple-notifications.json
使用方式(How to Use)
Hook 会自动生效,无需显式调用:
claude
> Read the package.json file
> Edit src/index.js and add a console.log
> Run npm test
系统要求
- macOS:使用
osascript(系统自带) - Linux:使用
notify-send(常见发行版自带或可安装)
# Debian/Ubuntu
sudo apt-get install libnotify-bin
自定义示例
{
"description": "Send desktop notifications with custom messages",
"hooks": {
"PostToolUse": [
{
"matcher": "Read|Write|Edit",
"hooks": [
{
"type": "command",
"command": "notify-send 'Custom Title' 'File operation: $CLAUDE_TOOL_NAME done!'"
}
]
}
]
}
}
排障(Troubleshooting)
- macOS:检查终端通知权限
- Linux:确认
notify-send是否安装
which notify-send
notify-send "Test" "This is a test notification"