a modern tui library written in zig

vaxis: implement osc9 and osc777 notifications

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>

+26 -2
+2 -2
README.md
··· 24 24 | Styled Underlines | ✅ | ✅ | ✅ | 25 25 | Mouse Shapes (OSC 22) | ✅ | planned | ❌ | 26 26 | System Clipboard (OSC 52) | ✅ | planned | ❌ | 27 - | System Notifications (OSC 9) | ✅ | planned | ❌ | 28 - | System Notifications (OSC 777) | ✅ | planned | ❌ | 27 + | System Notifications (OSC 9) | ✅ | ✅ | ❌ | 28 + | System Notifications (OSC 777) | ✅ | ✅ | ❌ | 29 29 | Synchronized Output (DEC 2026) | ✅ | ✅ | ✅ | 30 30 | Unicode Core (DEC 2027) | ✅ | ✅ | ❌ | 31 31 | Color Mode Updates (DEC 2031) | ✅ | planned | ❌ |
+2
examples/text_input.zig
··· 71 71 break :outer; 72 72 } else if (key.matches('l', .{ .ctrl = true })) { 73 73 vx.queueRefresh(); 74 + } else if (key.matches('n', .{ .ctrl = true })) { 75 + try vx.notify("vaxis", "hello from vaxis"); 74 76 } else { 75 77 try text_input.update(.{ .key_press = key }); 76 78 }
+2
src/cell.zig
··· 22 22 bg: Color = .default, 23 23 ul: Color = .default, 24 24 ul_style: Underline = .off, 25 + // TODO: url should maybe go outside of style. We'll need to allocate these 26 + // in the internal screen 25 27 url: ?[]const u8 = null, 26 28 url_params: ?[]const u8 = null, 27 29
+2
src/ctlseqs.zig
··· 76 76 // OSC sequences 77 77 pub const osc8 = "\x1b]8;{s};{s}\x1b\\"; 78 78 pub const osc8_clear = "\x1b]8;;\x1b\\"; 79 + pub const osc9_notify = "\x1b]9;{s}\x1b\\"; 80 + pub const osc777_notify = "\x1b]777;notify;{s};{s}\x1b\\";
+18
src/vaxis.zig
··· 472 472 ); 473 473 try self.tty.?.flush(); 474 474 } 475 + 476 + /// send a system notification 477 + pub fn notify(self: *Self, title: ?[]const u8, body: []const u8) !void { 478 + if (self.tty == null) return; 479 + if (title) |t| { 480 + try std.fmt.format( 481 + self.tty.?.buffered_writer.writer(), 482 + ctlseqs.osc777_notify, 483 + .{ t, body }, 484 + ); 485 + } else { 486 + try std.fmt.format( 487 + self.tty.?.buffered_writer.writer(), 488 + ctlseqs.osc9_notify, 489 + .{body}, 490 + ); 491 + } 492 + } 475 493 }; 476 494 } 477 495