Skip to content

Commit e672ca2

Browse files
StuBehanclaude
andcommitted
feat(#18): detect Zed as a host editor
Adds Zed to notify.sh's editor-detection layer so notifications fired from agents running inside Zed's integrated terminal route correctly: - TERM_PROGRAM=zed → bundle ID dev.zed.Zed (Zed sets this env var since zed-industries/zed#14213, merged 2024-07). - bundle ID dev.zed.Zed → process name Zed (used by System Events for window-title capture and frontmost-window suppression). - Adds Zed to walk_session_chain's terminal-app match list so the panel's session view records Zed correctly when walking the process tree. Zed has no external hook system of its own (hooks are not supported in external agents — see Zed docs), so stack-nudge relies on the agent's own hooks (e.g. ~/.claude/settings.json) firing from inside Zed's terminal. The agent-side wiring is already auto-detected by install.sh; this PR only adds the editor-side recognition for click-to-focus and mute-when-focused suppression. README updated with the supported-apps list + a note explaining the hook flow for Zed users. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3c9ed47 commit e672ca2

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ The hook calls `notify.sh <agent> <event>`, which plays a sound and shows a bann
5353

5454
When you click the banner, `stack-nudge.app` uses System Events to raise the exact window that triggered the notification — even if you have multiple Cursor or terminal windows open. Supported apps:
5555

56-
- Cursor, VS Code
56+
- Cursor, VS Code, Zed
5757
- iTerm2, Warp, Ghostty, Terminal.app
5858

5959
If the target app is already in focus when the notification fires, the banner is suppressed and only the sound plays.
6060

61+
> **Note on Zed:** Zed itself doesn't expose an external hook system, so stack-nudge relies on the agent's hooks (e.g. `~/.claude/settings.json` for Claude Code) firing from inside Zed's integrated terminal. Click-to-focus and frontmost-window suppression are wired up via `TERM_PROGRAM=zed`, which Zed sets automatically.
62+
6163
### Immediate focus mode
6264

6365
If you'd rather have your editor focus automatically — no click needed:

notify.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ walk_session_chain() {
268268
case "$base" in
269269
"Code Helper"|"Code Helper (Plugin)"|"Code Helper (Renderer)"|Code|\
270270
"Cursor Helper"|"Cursor Helper (Plugin)"|"Cursor Helper (Renderer)"|Cursor|\
271+
Zed|zed|\
271272
iTerm2|iTerm|Terminal|Warp|WarpTerminal|ghostty|Ghostty)
272273
TERMINAL_PID="$pid"; TERMINAL_APP="$base"; break ;;
273274
esac
@@ -356,7 +357,8 @@ notify_macos() {
356357
local sound="$3"
357358
local voice_message="${4:-$message}"
358359

359-
# Detect terminal / editor bundle ID for click-to-focus
360+
# Detect terminal / editor bundle ID for click-to-focus.
361+
# Zed sets TERM_PROGRAM=zed in its integrated terminal as of zed-industries/zed#14213.
360362
local bundle_id
361363
case "${TERM_PROGRAM}" in
362364
vscode)
@@ -366,6 +368,7 @@ notify_macos() {
366368
bundle_id="com.microsoft.VSCode"
367369
fi
368370
;;
371+
zed) bundle_id="dev.zed.Zed" ;;
369372
iTerm.app) bundle_id="com.googlecode.iterm2" ;;
370373
WarpTerminal) bundle_id="dev.warp.Warp-Stable" ;;
371374
ghostty) bundle_id="com.mitchellh.ghostty" ;;
@@ -377,6 +380,7 @@ notify_macos() {
377380
case "$bundle_id" in
378381
com.todesktop.230313mzl4w4u92) process_name="Cursor" ;;
379382
com.microsoft.VSCode) process_name="Code" ;;
383+
dev.zed.Zed) process_name="Zed" ;;
380384
com.googlecode.iterm2) process_name="iTerm2" ;;
381385
dev.warp.Warp-Stable) process_name="Warp" ;;
382386
com.mitchellh.ghostty) process_name="Ghostty" ;;

0 commit comments

Comments
 (0)