Get tags working with actual tag-switching support

I added 7 new Commands to XkbKeybinds.Commands, though 3 of them don't
work yet.

The new commands that *work* are

+    set_output_tags: u32,
+    set_window_tags: u32,
+    toggle_output_tags: u32,
+    toggle_window_tags: u32,

They each take a 32-bit value as a bitmask to set (or toggle) tags.

The 3 unimplemented commands are

+    spawn_tagmask: u32,
+    focus_previous_tags,
+    send_to_previous_tags,

and they will all panic if they're used.

For now, default keybinds are hardcoded as part of WindowManager's
initializing in the first \`manage_start\` event. Multi-output support
is not added yet, so this will still all happen on a single Output.
This commit is contained in:
Ben Buhse 2026-01-26 17:44:34 -06:00
commit 9030de6b64
No known key found for this signature in database
GPG key ID: 7916ACFCD38FD0B4
4 changed files with 83 additions and 5 deletions

View file

@ -18,7 +18,11 @@ fullscreen: bool = false,
maximized: bool = false,
tags: u32 = 0x0001,
output: ?*Output,
// output: ?*Output,
// XXX: Do I really even need to store `show`?
// I think I only would if I was trying not to send extraneous requests.
show: bool = true,
initialized: bool = false,
@ -42,6 +46,7 @@ pub const PendingManage = struct {
maximized: ?bool = null,
tags: ?u32 = null,
// output: ?*Output = null,
};
pub const PendingRender = struct {
@ -49,6 +54,8 @@ pub const PendingRender = struct {
y: ?i32 = null,
focused: ?bool = null,
show: ?bool = null,
};
pub fn create(context: *Context, river_window_v1: *river.WindowV1, output: *Output) !*Window {
@ -59,11 +66,11 @@ pub fn create(context: *Context, river_window_v1: *river.WindowV1, output: *Outp
.context = context,
.river_window_v1 = river_window_v1,
.river_node_v1 = river_window_v1.getNode() catch @panic("Failed to get node"),
// .output = output,
.tags = if (output.tags != 0) output.tags else 0x0001,
.link = undefined, // Handled by the wl.list
};
window.river_window_v1.setListener(*Window, windowListener, window);
return window;
@ -197,6 +204,19 @@ pub fn render(window: *Window) void {
}
}
}
// Show or hide the Window
if (window.pending_render.show) |show| {
if (show) {
if (!window.show) {
window.river_window_v1.show();
}
} else {
if (window.show) {
window.river_window_v1.hide();
}
}
}
}
fn applyBorders(window: *Window, color: utils.RiverColor) void {