给Claude Code增加一个Windows消息通知
- 内容介绍
- 文章标签
- 相关推荐
写了个notify.ps1脚本,在Claude Code完成之后弹出通知 ,方便通知摸鱼的你回来确认 。效果图如下:
PixPin_2026-04-01_13-45-52501×535 32.3 KB
这里先安装 BurntToast 模块,在 PowerShell(管理员模式)中运行:
Install-Module -Name BurntToast -Force
在.claude/settings.json中添加以下hooks配置:
{
"hooks": {
"Notification": [
{
"hooks": [
{
"command": "powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:/Users/YouName/notify.ps1\" -Event Notification",
"timeout": 15,
"type": "command"
}
],
"matcher": ""
}
],
"Stop": [
{
"hooks": [
{
"command": "powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:/Users/YouName/notify.ps1\" -Event Stop",
"timeout": 15,
"type": "command"
}
],
"matcher": ""
}
]
}
}
https://gist.github.com/RisenMyth/6297cab96eb9dec912cc6c126cbed965
notify.ps1
param(
[string]$Event = "Stop"
)
# Force UTF-8 to correctly read Chinese and other unicode from Claude Code
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# =========================
# Toast Settings
此文件已被截断。 显示原始文件
settings.json
{
"hooks": {
"Notification": [
{
"hooks": [
{
"command": "powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:/Users/you_name/notify.ps1\" -Event Notification",
"timeout": 15,
"type": "command"
}
此文件已被截断。 显示原始文件
网友解答:
--【壹】--:
太有用了
--【贰】--:
感谢大佬
--【叁】--:
还有其他MCP方案,比如完成后播放声音的,都可以配置
--【肆】--:
目前我最常用 codex 和 opencode,都支持
--【伍】--:
我是配置了个ntfy-me-mcp,然后在系统上下文中加规则,长任务执行完成后给我发通知,手机安装app,苹果系生态电脑、手机、手表都能收到通知。
--【陆】--:
感谢分享~
--【柒】--:
这对我真的有用啦,感谢大佬^ω^
--【捌】--:
mcp方案需要给模型约定好触发规则吧?还是采用cc自带的hook方案比较稳妥一点。还有就是你提到的这个是多平台兼容吗?
--【玖】--:
!我给你个建议, 加一个语音通知,然后给一个软萌甜心妹子声线~
写了个notify.ps1脚本,在Claude Code完成之后弹出通知 ,方便通知摸鱼的你回来确认 。效果图如下:
PixPin_2026-04-01_13-45-52501×535 32.3 KB
这里先安装 BurntToast 模块,在 PowerShell(管理员模式)中运行:
Install-Module -Name BurntToast -Force
在.claude/settings.json中添加以下hooks配置:
{
"hooks": {
"Notification": [
{
"hooks": [
{
"command": "powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:/Users/YouName/notify.ps1\" -Event Notification",
"timeout": 15,
"type": "command"
}
],
"matcher": ""
}
],
"Stop": [
{
"hooks": [
{
"command": "powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:/Users/YouName/notify.ps1\" -Event Stop",
"timeout": 15,
"type": "command"
}
],
"matcher": ""
}
]
}
}
https://gist.github.com/RisenMyth/6297cab96eb9dec912cc6c126cbed965
notify.ps1
param(
[string]$Event = "Stop"
)
# Force UTF-8 to correctly read Chinese and other unicode from Claude Code
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
# =========================
# Toast Settings
此文件已被截断。 显示原始文件
settings.json
{
"hooks": {
"Notification": [
{
"hooks": [
{
"command": "powershell -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:/Users/you_name/notify.ps1\" -Event Notification",
"timeout": 15,
"type": "command"
}
此文件已被截断。 显示原始文件
网友解答:
--【壹】--:
太有用了
--【贰】--:
感谢大佬
--【叁】--:
还有其他MCP方案,比如完成后播放声音的,都可以配置
--【肆】--:
目前我最常用 codex 和 opencode,都支持
--【伍】--:
我是配置了个ntfy-me-mcp,然后在系统上下文中加规则,长任务执行完成后给我发通知,手机安装app,苹果系生态电脑、手机、手表都能收到通知。
--【陆】--:
感谢分享~
--【柒】--:
这对我真的有用啦,感谢大佬^ω^
--【捌】--:
mcp方案需要给模型约定好触发规则吧?还是采用cc自带的hook方案比较稳妥一点。还有就是你提到的这个是多平台兼容吗?
--【玖】--:
!我给你个建议, 加一个语音通知,然后给一个软萌甜心妹子声线~

