6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code Hooksで通知したときにVSCodeをアクティブにしてくれませんか!

Last updated at Posted at 2025-07-09

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'"
          }
        ]
      }
    ]
  }
}

参考

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?