Desktop notification routing¶
Silkie inherits kitty's OSC 99 desktop notification protocol. Applications can request a notification, ask to focus their terminal when it is activated, and receive the notification ID and selected button. The notify kitten provides a command-line sender.
OSC 9 and AI completion alerts¶
Silkie also accepts the iTerm2-style OSC 9 ; message ST notification,
terminated by either BEL or ESC \\. The entire message, including any
semicolons, becomes the notification title, unless it starts with a ConEmu
sub-command number from 1 to 12 followed by ; or the end of the message.
OSC 9 ; 2 ; text ST shows a notification titled text, with one pair of
surrounding double quotes removed. The other ConEmu sub-commands are described
in ConEmu OSC 9 sub-commands. Clicking a notification focuses the originating
terminal without sending input to the application. See the iTerm2 escape-code
manual for the wire format.
The OSC 9 ; 4 ; state ; percent ST form reports progress instead. Clearing
or completing a progress bar does not request a desktop notification. The
abbreviated OSC 9 ; 4 ST form clears progress as well.
To test desktop notification delivery, run this in a Silkie shell:
printf '\033]9;Silkie notification test\007'
On macOS, allow Silkie notifications when prompted. If no banner appears, check System Settings → Notifications → Silkie, banner settings, and Focus. Notification permission failures are logged to Silkie's standard error. Configured notification filters also apply to OSC 9.
ConEmu OSC 9 sub-commands¶
ConEmu uses OSC 9 for
numbered sub-commands, OSC 9 ; number ; arguments ST. An OSC 9 payload is a
ConEmu sub-command when it starts with a number from 1 to 12 followed by ;
or the end of the payload; any other payload, including 13;text, is shown as
an iTerm2 style notification. Text arguments may be enclosed in double quotes,
which are removed.
Number |
ConEmu |
Silkie |
|---|---|---|
1 |
Sleep for some milliseconds |
Not implemented |
2 |
Show a message box |
Shows a desktop notification with the text as its title |
3 |
Set the tab title |
Sets the tab title, empty text restores the default title |
4 |
Set the progress state |
Shows progress, as |
5 |
Wait for a key press |
Not implemented |
6 |
Run a GuiMacro |
Not implemented |
7 |
Run a process |
Not implemented |
8 |
Print an environment variable |
Not implemented |
9 |
Report the working directory |
Records the directory, like OSC 7 |
10 |
Control xterm emulation |
Not implemented |
11 |
Comment |
Ignored |
12 |
Mark the start of a prompt |
Marks the prompt exactly as |
Sub-commands that are not implemented are ignored, and logged only when Silkie
is run with --dump-commands.
Claude Code must emit a notification sequence for Silkie to display one.
If automatic terminal detection does not select a compatible protocol, set
"preferredNotifChannel": "iterm2" for OSC 9 or "kitty" for OSC 99 in
~/.claude/settings.json. See Claude Code's terminal notification setup
for notification timing and multiplexer configuration.
Return paths through multiplexers¶
Silkie adds optional r metadata to OSC 99. It identifies the windows a
notification crossed, allowing a click to restore the originating terminal
and nested multiplexer windows. This field does not change the notification
title or body.
Each hop is component/instance/window. Component and instance are nonempty
ASCII tokens containing letters, digits, underscores, or hyphens; window is
a decimal integer. Commas separate hops, listed from the originating application
outward. Neither delimiter needs base64 encoding:
i=foo:r=odin-seat/sessionA/3,odin-seat/sessionB/8
A multiplexer appends its own hop to every outgoing fragment. On activation,
Silkie preserves that route and appends silkie/<instance>/<window>; its
instance token identifies this notification manager and window is the native
terminal channel ID. For example:
ESC ] 99 ; i=foo:r=odin-seat/sessionA/3,odin-seat/sessionB/8,silkie/terminalC/12:a=focus,report ; 2 ST
The reply identifies button 2. a contains the effective requested actions,
including actions inherited across multipart notifications. An empty a=
means no actions. A route causes an activation reply even when report was
not requested, so multiplexers can restore windows for focus. Each hop
focuses its own window only when focus is present; the final multiplexer
delivers the reply to the application only when report was requested.
Report-only notifications do not take focus.
Silkie first focuses its native terminal when requested. Multiplexers then
restore windows from outside inward and preserve the complete route in the
application's reply. IDs are scoped by native channel and route, so two
windows may use the same application ID. Multipart fragments must repeat the
same ID and route. Close and capability replies echo the route; a capability
reply advertises r=1 in its payload. Requests without r retain kitty's
reply format.
Odin Seat convention¶
Odin Seat appends odin-seat/<session-token>/<window-id>. The random session
token survives a live server upgrade; window IDs remain stable within that
session. A closed window or stale session is never replaced by the currently
focused window when routing a click.
For hosts that do not echo r, Odin Seat also wraps the notification's
i in an opaque address. Nested multiplexers unwrap one address at a time;
the original application ID and full return path reach the caller. No pending
notification table or fixed ID length is required. Treat the wrapped ID as
opaque rather than constructing one in an application.
Odin Seat converts OSC 9 and OSC 777 notify;title;body to OSC 99 with focus
and report actions. It consumes the final click reply for these senders, which
did not request an input protocol. An OSC 99 caller can request report to
receive its original ID, selected button, and full route. Older hosts can focus
converted notifications through the wrapped ID, but need this Silkie extension
to return the full route and requested actions.
Codex configuration¶
For a Codex version supporting these settings, place this in
~/.codex/config.toml and start a new Codex session:
[tui]
notifications = true
notification_method = "osc9"
notification_condition = "unfocused"
Odin Seat forwards DECSET 1004 focus reports to applications. A pane is focused when it is Odin Seat's active visible window and an attached host terminal is focused. Switching panes, detaching, and returning through a notification update that state, including through nested Odin Seat sessions.