From e672ca2c080023f431b7a0ef44b7ea1fc42dbe4e Mon Sep 17 00:00:00 2001 From: StuBehan Date: Fri, 1 May 2026 00:17:12 +0200 Subject: [PATCH] feat(#18): detect Zed as a host editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- README.md | 4 +++- notify.sh | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7efdbc7..a5dab05 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,13 @@ The hook calls `notify.sh `, which plays a sound and shows a bann 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: -- Cursor, VS Code +- Cursor, VS Code, Zed - iTerm2, Warp, Ghostty, Terminal.app If the target app is already in focus when the notification fires, the banner is suppressed and only the sound plays. +> **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. + ### Immediate focus mode If you'd rather have your editor focus automatically — no click needed: diff --git a/notify.sh b/notify.sh index 5a8a626..d726cf5 100755 --- a/notify.sh +++ b/notify.sh @@ -268,6 +268,7 @@ walk_session_chain() { case "$base" in "Code Helper"|"Code Helper (Plugin)"|"Code Helper (Renderer)"|Code|\ "Cursor Helper"|"Cursor Helper (Plugin)"|"Cursor Helper (Renderer)"|Cursor|\ + Zed|zed|\ iTerm2|iTerm|Terminal|Warp|WarpTerminal|ghostty|Ghostty) TERMINAL_PID="$pid"; TERMINAL_APP="$base"; break ;; esac @@ -356,7 +357,8 @@ notify_macos() { local sound="$3" local voice_message="${4:-$message}" - # Detect terminal / editor bundle ID for click-to-focus + # Detect terminal / editor bundle ID for click-to-focus. + # Zed sets TERM_PROGRAM=zed in its integrated terminal as of zed-industries/zed#14213. local bundle_id case "${TERM_PROGRAM}" in vscode) @@ -366,6 +368,7 @@ notify_macos() { bundle_id="com.microsoft.VSCode" fi ;; + zed) bundle_id="dev.zed.Zed" ;; iTerm.app) bundle_id="com.googlecode.iterm2" ;; WarpTerminal) bundle_id="dev.warp.Warp-Stable" ;; ghostty) bundle_id="com.mitchellh.ghostty" ;; @@ -377,6 +380,7 @@ notify_macos() { case "$bundle_id" in com.todesktop.230313mzl4w4u92) process_name="Cursor" ;; com.microsoft.VSCode) process_name="Code" ;; + dev.zed.Zed) process_name="Zed" ;; com.googlecode.iterm2) process_name="iTerm2" ;; dev.warp.Warp-Stable) process_name="Warp" ;; com.mitchellh.ghostty) process_name="Ghostty" ;;