diff --git a/src/ctlseqs.zig b/src/ctlseqs.zig index f4e6cea..0cc2cd5 100644 --- a/src/ctlseqs.zig +++ b/src/ctlseqs.zig @@ -74,6 +74,7 @@ pub const invisible_reset = "\x1b[28m"; pub const strikethrough_reset = "\x1b[29m"; // OSC sequences +pub const osc2_set_title = "\x1b]2;{s}\x1b\\"; pub const osc8 = "\x1b]8;{s};{s}\x1b\\"; pub const osc8_clear = "\x1b]8;;\x1b\\"; pub const osc9_notify = "\x1b]9;{s}\x1b\\"; diff --git a/src/vaxis.zig b/src/vaxis.zig index 915a2be..abafc86 100644 --- a/src/vaxis.zig +++ b/src/vaxis.zig @@ -490,6 +490,16 @@ pub fn Vaxis(comptime T: type) type { ); } } + + /// sets the window title + pub fn setTitle(self: *Self, title: []const u8) !void { + if (self.tty == null) return; + try std.fmt.format( + self.tty.?.buffered_writer.writer(), + ctlseqs.osc2_set_title, + .{title}, + ); + } }; }