|
|
|
|
|
by hombre_fatal
89 days ago
|
|
My notification hook pipes an OSC 777 (title, body) message into /dev/tty, Ghostty handles/ingests it and then emits the event for my terminal app to do things like craft a macOS notif and style the tab/pane of the originating terminal. #!/usr/bin/env bash
MSG=$(cat | jq -r '.last_assistant_message // empty' | head -c 200)
printf '\e]777;notify;Claude Code;%s\a' "${MSG:-Claude finished responding}" > /dev/tty
I tried the osascript solution first but had some issues, iirc no good way to focus the originating terminal pane on notif click.Something I never figured out is why Claude Code's "Notification" hook waits minutes to fire. I had to use the "Stop" hook for actual end-of-response timing. |
|
Yeah mine has the same issue - it just brings up the script editor. It's not as much of an issue for me since I'm rarely running more than a single Opencode instance at a time.
Could definitely see that being useful if you were running quite a few agents to let you hone in on the correct terminal window/tab quickly though.