You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: OSC 9 terminal notifications for TUI toasts #4454
Add optional OSC 9 desktop notifications from the TUI, triggered when important events occur (starting with TUI toasts for agent completion and approvals), similar to how the Codex TUI and Claude Code surface notifications when the terminal is not in focus.
Motivation
OpenCode is TUI-first, and many terminals (kitty, iTerm2, etc.) support OSC 9 notifications to surface important events when the terminal is not focused.
Codex TUI and Claude Code both send notifications so users know when an agent has finished or needs attention; adding a small, optional version here improves UX parity without external dependencies.
Proposed Scope (minimal version)
Add a small helper in that emits an OSC 9 sequence to stdout when running in a TTY (ESC ] 9 ; BEL).
Centralize usage through the existing toast system rather than calling OSC 9 all over the place:
In , when toast.show is called, also emit an OSC 9 notification using either the toast title or message.
The server and TUI event handling logic raise tui.toast.show events for noteworthy moments like:
When the agent finishes responding for the active session (for example, when the session transitions to idle).
When a new permission or approval is required for the active session.
The TUI then shows a visual toast and, via the helper, emits OSC 9 so supported terminals can show a desktop notification with the same text.
This keeps OSC 9 as a TUI-only concern, reuses existing UI primitives, and keeps the surface area small (no new endpoints, no SDK changes) while still giving a good default experience.
Possible Extensions / Open Questions
Add a simple config toggle under config.tui.notifications to enable/disable OSC 9 notifications or restrict them to certain events.
Consider further events (for example, long-running operations finishing) once a minimal version is in.
Potentially respect terminal focus if there is a straightforward way to get focus gained/lost signals via the current TUI stack, mirroring Codex TUI behavior of only notifying when unfocused.
If this sounds reasonable, I can open a PR implementing this.
Activity
rekram1-node commentedon Nov 18, 2025
I think that's an interesting idea