anomalyco / anomalyco/opencode
[FEATURE]: Fall back to OSC 9 desktop notifications when OSC 99 is unsupported (Zed, Ghostty, etc.)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
In terminals that support OSC 9 (or OSC 777) but not OSC 99, opencode never shows desktop notifications — only the attention sound plays.
Environment
- opencode v2.0.10
- Linux (KDE Plasma / Wayland)
- Terminal: Zed 1.20.2 integrated terminal
- Config:
attention: { enabled: true, notifications: true, sound: true }
What happens
- The attention sound plays as expected.
- No desktop notification is ever shown.
Root cause (investigated)
Notification support is detected in OpenTUI's native layer, which probes for OSC 99 (\x1b]99;i=opentui-notifications:p=?;\x1b\\) and iTerm2 OSC 1337;Capabilities. renderer.triggerNotification returns false until notification capability is detected, and notifications are only ever emitted as OSC 99 — there is no OSC 9 / OSC 777 fallback.
Zed added OSC 9 desktop notification support in zed-industries/zed#58014 (merged 2026-06) but does not implement OSC 99 or iTerm2 OSC 1337. Therefore capabilities.notifications stays false, and packages/tui/src/attention.ts silently skips the notification path.
The same limitation applies to other OSC 9/777-only terminals: Ghostty, Warp, VS Code integrated terminal, WezTerm (OSC 777 only for notifications), etc.
Proposal
When OSC 99 capability is not detected, fall back to emitting OSC 9 (\x1b]9;<message>\x07). It is widely supported (kitty, Zed, Ghostty, WezTerm, foot, iTerm2, Warp) and harmless when ignored.
This could live either in packages/tui/src/attention.ts (when triggerNotification returns false) or in OpenTUI's native notification path, alongside the existing OSC 99 support.
Related
- #35055 — desktop notifications silently suppressed when terminal focus tracking is unavailable (related failure mode, closed
not_planned) - anomalyco/opentui#1067 — OSC 99 probes restricted to XT_VERSION-identified terminals
- anomalyco/opentui#1333 — focus reporting gated on a DECRQM answer
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/tui/src/attention.ts and trace the notification path when renderer.triggerNotification returns false; then inspect OpenTUI’s native notification path and its existing OSC 99 capability handling. Done means OSC 9 is emitted for terminals without detected OSC 99 support while existing OSC 99 behavior remains intact; verify the notification and sound behavior in the described terminal scenarios.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100