You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
More configurable preferredNotifChannel (run an arbitrary script) #104
My most immediate use case would be something like this.
#!/usr/bin/env bash
/usr/bin/osascript -e 'display notification "Awaiting input" with title "Claude"'
If you passed in some info into the args, like if it's waiting for approval to do something or if it's completed a task (or if there was an error, ran out of context, etc) and maybe a (very short) summary of what it did, that could be put into the notification.
Honestly now that I think about it this could probably be an MCP server. But something simple like that would be sufficient.
Reacted by Boris Cherny, Roman Strakhov and DonMecca
We don't yet have arbitrary scripts, but the new version does have better automatic notification behavior including support for Ghostty. Let us know if it works for you!
The bell doesn’t work in my terminal, making this a bottleneck. Just like other configs, we should be able to set a notification script: claude config set -g path_to_notification_script /path/to/notify.sh.
Claude should call it when needed, with args for type (e.g., permission request, completion) and brief text. I’d use it for custom sounds and notify-send.
What terminal are you using Roman? I hear you on the request for custom notification script - it makes sense, but we do want to have things work by default as broadly as possible as well.
I use ghostty with tmux. Tmux eats the OSC sequence (iterm2 style notifications).
While I could setup the bell to do a proper notification, I do not want all bell trigger to do a notification. Just claude code.
Being able to setup a custom script would unblock anyone with a custom setup to self serve.
This would be such a win - I would also like notifications that are more elaborate (eg speak to me or ping my phone). Often I'm in another room (what a time to be alive! ;p) and want to know when my coding companion needs my help.
In MacOS there is this brew package https://github.com/julienXX/terminal-notifier that can send a MacOS native notification. It would be awesome if I can trigger this script with a custom message based on the state of Claude Code. For example, the notification can be different in the case of ClaudeCode waiting for user input or when it is done vibe-coding.
~/.claude/scripts/notify.sh
#!/bin/bash
osascript -e "display notification \"$2\" with title \"$1\" sound name \"Submarine\""
say "I'm done"
Patch cli.js make sure you back it up first this is for version 1.0.31
sed -i '''s/hF5(A,B){return;/hF5(A,B){/g' /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js
This works for me, im investigating on how to get more notifications working e.g. when it ask a question with 3 answers you can choose from
UPDATE
i got tired of looking at cli.js and asked claude to do this for me, seems to be working
# Add notification for KV function (general permissions)
sed -i '''/z1("tengu_tool_use_show_permission_request",{messageID:A\.assistantMessage\.message\.id,toolName:A\.tool\.name})/a\;(async()=>{try{if(ZA().customNotifyCommand)await hF5({title:"Claude Code",message:"Needs permission to proceed"},ZA().customNotifyCommand)}catch(e){}})()' /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js
# Add notification for tH1 function (tool use permissions)
sed -i '''/z1("tengu_tool_use_show_permission_request",{messageID:A\.assistantMessage\.message\.id,toolName:A\.tool\.name,isMcp:A\.tool\.isMcp/a\;(async()=>{try{if(ZA().customNotifyCommand)await hF5({title:"Claude Code",message:"Needs permission to proceed"},ZA().customNotifyCommand)}catch(e){}})()' /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
bcherny commentedon Feb 26, 2025
That's a cool idea. What were you thinking of making your script do?
tylerkahn commentedon Feb 26, 2025
My most immediate use case would be something like this.
If you passed in some info into the args, like if it's waiting for approval to do something or if it's completed a task (or if there was an error, ran out of context, etc) and maybe a (very short) summary of what it did, that could be put into the notification.
Honestly now that I think about it this could probably be an MCP server. But something simple like that would be sufficient.
tylerkahn commentedon Feb 26, 2025
Just to give a bit more context, iTerm2 is a bit dated. Things like Ghostty are more cutting edge and it happens to lack support for visual bell.
igorkofman commentedon Mar 12, 2025
We don't yet have arbitrary scripts, but the new version does have better automatic notification behavior including support for Ghostty. Let us know if it works for you!
Roman- commentedon Mar 15, 2025
The bell doesn’t work in my terminal, making this a bottleneck. Just like other configs, we should be able to set a notification script:
claude config set -g path_to_notification_script /path/to/notify.sh.Claude should call it when needed, with args for type (e.g., permission request, completion) and brief text. I’d use it for custom sounds and
notify-send.igorkofman commentedon Mar 16, 2025
What terminal are you using Roman? I hear you on the request for custom notification script - it makes sense, but we do want to have things work by default as broadly as possible as well.
Roman- commentedon Mar 17, 2025
I'm on a heavily customized setup, so defaults don’t apply
hirowatari commentedon May 16, 2025
I'd love this feature too. Using terminator on arch.
JoeDupuis commentedon May 26, 2025
I use ghostty with tmux. Tmux eats the OSC sequence (iterm2 style notifications).
While I could setup the bell to do a proper notification, I do not want all bell trigger to do a notification. Just claude code.
Being able to setup a custom script would unblock anyone with a custom setup to self serve.
Supporting allow-passthrough for tmux would be nice too.
https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it
jkp commentedon Jun 7, 2025
This would be such a win - I would also like notifications that are more elaborate (eg speak to me or ping my phone). Often I'm in another room (what a time to be alive! ;p) and want to know when my coding companion needs my help.
AnhQuanTrl commentedon Jun 19, 2025
In MacOS there is this brew package https://github.com/julienXX/terminal-notifier that can send a MacOS native notification. It would be awesome if I can trigger this script with a custom message based on the state of Claude Code. For example, the notification can be different in the case of ClaudeCode waiting for user input or when it is done vibe-coding.
n0x00x commentedon Jun 21, 2025
here is what i got working:
create file
Patch
cli.jsmake sure you back it up first this is for version 1.0.31This works for me, im investigating on how to get more notifications working e.g. when it ask a question with 3 answers you can choose from
UPDATE
i got tired of looking at cli.js and asked claude to do this for me, seems to be working
kushal-thakkar commentedon Aug 22, 2025
This is already supported through Hooks now, so closing this issue now.
github-actions commentedon Aug 31, 2025
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.