show names on tabs in tabbed layout

This commit is contained in:
2026-08-01 14:19:24 +02:00
parent 8d99d9171c
commit 4a08d19365
7 changed files with 457 additions and 12 deletions
+13
View File
@@ -137,6 +137,15 @@ pub fn applyRules(self: *Window) void {
}
}
/// Whether this window currently has a tab drawn for it, i.e. it is tiled and
/// visible on an output that is showing the tabbed layout.
fn onTabBar(self: *Window) bool {
if (config.tabbar_height <= 0) return false;
if (!self.visible or self.floating or self.fullscreen or self.closed) return false;
const out = self.output orelse return false;
return out.state().layout == .tabbed;
}
fn setString(self: *Window, field: *?[]u8, value: ?[*:0]const u8) void {
const gpa = self.wm.gpa;
if (field.*) |old| gpa.free(old);
@@ -190,6 +199,10 @@ fn onEvent(_: *river.WindowV1, event: river.WindowV1.Event, self: *Window) void
self.setString(&self.title, ev.title);
self.applyRules();
self.wm.ipcDirty();
// The tab bar has this title painted into it, so a window that is
// wearing a tab needs the strip redrawn. Terminals retitle
// themselves constantly, so ask only when it will show.
if (self.onTabBar()) self.wm.needsManage();
},
.identifier => |ev| {