Terminology supports hyperlinks (osc8) and notifications through osc777 (#1566)

Co-authored-by: Simon Klee <hello@simonklee.dk>
This commit is contained in:
Boris FaureandSimon Klee authored and GitHub committed 2026-10-08 11:08:18 +02:00
1 parent 6f0efd3330
commit 6f26ed24d5
4 files changed
+24 -10

No files matched your search

+4 -2
View File
@@ -565,7 +565,8 @@ fn detectNotificationProtocol(value: []const u8) ?NotificationProtocol {
std.ascii.findIgnoreCase(value, "urxvt") != null or
std.ascii.findIgnoreCase(value, "rxvt") != null or
std.ascii.findIgnoreCase(value, "windows terminal") != null or
std.ascii.findIgnoreCase(value, "windows_terminal") != null)
std.ascii.findIgnoreCase(value, "windows_terminal") != null or
std.ascii.findIgnoreCase(value, "terminology") != null)
{
return .osc777;
}
@@ -1463,7 +1464,8 @@ fn isHyperlinkTerm(value: []const u8) bool {
std.ascii.findIgnoreCase(value, "alacritty") != null or
std.ascii.findIgnoreCase(value, "foot") != null or
std.ascii.findIgnoreCase(value, "iterm") != null or
std.ascii.findIgnoreCase(value, "xterm.js") != null;
std.ascii.findIgnoreCase(value, "xterm.js") != null or
std.ascii.findIgnoreCase(value, "terminology") != null;
}
fn isHyperlinkHostEnv(env_map: *const std.process.Environ.Map) bool {
@@ -28,6 +28,18 @@ test "parseXtversion - ghostty format" {
try testing.expect(term.caps.hyperlinks);
}
test "parseXtversion - terminology format enables hyperlinks and osc777 notifications" {
var term = Terminal.init(.{});
const response = "\x1bP>|terminology 1.14.0\x1b\\";
term.processCapabilityResponse(response);
try testing.expectEqualStrings("terminology", term.getTerminalName());
try testing.expectEqualStrings("1.14.0", term.getTerminalVersion());
try testing.expect(term.term_info.from_xtversion);
try testing.expect(term.caps.hyperlinks);
try testing.expectEqual(Terminal.NotificationProtocol.osc777, term.notification_protocol);
}
test "parseXtversion - tmux format" {
var term = Terminal.init(.{});
const response = "\x1bP>|tmux 3.5a\x1b\\";
@@ -51,11 +51,11 @@ An OSC 99 reply must include the OpenTUI query identifier, `p=?`, and title supp
Known terminal identities select these protocols:
| Protocol | Detected terminal families |
| -------- | ----------------------------------------------------------------------------------------------------------------------- |
| OSC 99 | Kitty and foot |
| OSC 777 | Ghostty, WezTerm, Warp, hterm, Blink, Contour, VTE, GNOME Terminal, Tilix, Terminator, Xfce, rxvt, and Windows Terminal |
| OSC 9 | iTerm, Apple Terminal, Terminal.app, and ConEmu |
| Protocol | Detected terminal families |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| OSC 99 | Kitty and foot |
| OSC 777 | Ghostty, WezTerm, Warp, hterm, Blink, Contour, VTE, GNOME Terminal, Tilix, Terminator, Xfce, rxvt, Terminology, and Windows Terminal |
| OSC 9 | iTerm, Apple Terminal, Terminal.app, and ConEmu |
Environment hints can select the same protocols. `TERM_FEATURES` with `No` selects OSC 9. `WT_SESSION` selects OSC 777. Detection is terminal-mediated and does not call `notify-send`, AppleScript, PowerShell, or another platform notification command.
@@ -106,9 +106,9 @@ Read [Image](/docs/components/image) for protocol selection. Do not choose a pro
The renderer emits OSC 8 sequences only when `hyperlinks` is true. Text still renders when it is false. Without OSC 8,
the terminal detects URLs one row at a time, so a wrapped URL opens only the part on the clicked row.
OpenTUI enables `hyperlinks` for Ghostty, Kitty, WezTerm, Alacritty, foot, iTerm2, xterm.js, VS Code, Zed, mintty,
VTE 0.52.2 or newer, and Windows Terminal. `TERM_PROGRAM` and `VTE_VERSION` count only outside tmux, Zellij, and GNU
Screen. Set `FORCE_HYPERLINK` to override detection.
OpenTUI enables `hyperlinks` for Ghostty, Kitty, WezTerm, Alacritty, foot, iTerm2, Terminology, xterm.js, VS Code,
Zed, mintty, VTE 0.52.2 or newer, and Windows Terminal. `TERM_PROGRAM` and `VTE_VERSION` count only outside tmux,
Zellij, and GNU Screen. Set `FORCE_HYPERLINK` to override detection.
Hyperlink URLs use a native slot with a maximum of 512 UTF-8 bytes. A longer URL fails link allocation and the text
loses its hyperlink metadata.