Claude Code Hooksの通知を使ったが......
Claude Code Hooksで通知が受け取れるようになりました!
早速設定してみたのですが、バナーを押してもスクリプトエディタに飛んでしまうように設定が多く、自動的にClaude Codeを実行しているウィンドウに遷移してくれないかなと思ったので設定をしてみました。
設定方法
.claude/settings.local.json を作成し以下のコードを貼り付けます。
今回はosascriptコマンドを使ってMacの通知を行っています。
Stop、Notificationでhooksは設定しています。
バナーが通知されると当時にVSCodeがアクティブになります!
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "osascript -e $'display notification \"確認することがあります!\" with title \"claude code\" sound name \"Glass\" \ntell application id \"com.microsoft.VSCode\" to activate'"
}
]
}
],
"Notification": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "osascript -e $'display notification \"タスクが完了しました。\" with title \"claude code\" sound name \"Glass\" \ntell application id \"com.microsoft.VSCode\" to activate'"
}
]
}
]
}
}
参考