Skip to content

feat: detect Zed as a host editor (closes #18)#21

Merged
StuBehan merged 1 commit into
StackOneHQ:mainfrom
StuBehan:feat/zed-editor-detection
Apr 30, 2026
Merged

feat: detect Zed as a host editor (closes #18)#21
StuBehan merged 1 commit into
StackOneHQ:mainfrom
StuBehan:feat/zed-editor-detection

Conversation

@StuBehan
Copy link
Copy Markdown
Collaborator

Closes #18.

Summary

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` for System Events window-title capture and frontmost-window suppression.
  • `walk_session_chain` recognises Zed so the panel's Sessions view records the host editor correctly.

Why this is the only change needed

Zed has no external hook system of its own (Zed docs explicitly state "hooks are currently not supported in external agents"), so stack-nudge can't wire up a Zed-side `hooks.json` the way it does for Claude Code and Cursor. But the agent's own hooks (e.g. `~/.claude/settings.json`) still fire normally from inside Zed's integrated terminal — `install.sh` already auto-wires those. The only gap was that `notify.sh` didn't know how to map the agent's host editor back to a Zed window, so click-to-focus and mute-when-focused targeted the wrong app.

Test plan

  • `shellcheck --severity=warning notify.sh` passes
  • `bash -n notify.sh` passes
  • Mapping smoketest: `TERM_PROGRAM=zed` → `bundle_id=dev.zed.Zed` → `process_name=Zed`
  • Manual: install Zed, run Claude Code inside its integrated terminal, trigger a permission prompt, click the banner, confirm the right Zed window comes to front
  • Manual: confirm that with `STACKNUDGE_MUTE_WHEN_FOCUSED=true` (default), notifications are suppressed when the Zed window is already frontmost

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>
@StuBehan StuBehan merged commit a8c5e5b into StackOneHQ:main Apr 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zed support.

1 participant