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

@ -104,6 +104,9 @@ fn calculatePrimaryStackLayout(wm: *WindowManager) void {
if (output.tags & window.tags != 0x0000) {
active_list.append(&window.active_list_node);
active_count += 1;
window.pending_render.show = true;
} else {
window.pending_render.show = false;
}
}
@ -185,9 +188,21 @@ fn manage_start(wm: *WindowManager) void {
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.t, .{ .mod4 = true }, .{ .spawn = &.{"foot"} });
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.j, .{ .mod4 = true }, .focus_next);
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.k, .{ .mod4 = true }, .focus_prev);
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.f, .{ .mod4 = true }, .fullscreen);
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.f, .{ .mod4 = true }, .toggle_fullscreen);
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.q, .{ .mod4 = true, .shift = true }, .close_window);
context.xkb_bindings.addBinding(river_seat_v1, xkbcommon.Keysym.e, .{ .mod4 = true, .shift = true }, .exit);
// Tag bindings
comptime var i: u8 = 1;
comptime var buffer: [1]u8 = undefined;
inline while (i <= 9) : (i += 1) {
const tags: u32 = 1 << (i - 1);
buffer[0] = i + '0';
context.xkb_bindings.addBinding(river_seat_v1, @field(xkbcommon.Keysym, &buffer), .{ .mod4 = true }, .{ .set_output_tags = tags });
context.xkb_bindings.addBinding(river_seat_v1, @field(xkbcommon.Keysym, &buffer), .{ .mod4 = true, .shift = true }, .{ .set_window_tags = tags });
context.xkb_bindings.addBinding(river_seat_v1, @field(xkbcommon.Keysym, &buffer), .{ .mod4 = true, .ctrl = true }, .{ .toggle_output_tags = tags });
context.xkb_bindings.addBinding(river_seat_v1, @field(xkbcommon.Keysym, &buffer), .{ .mod4 = true, .shift = true, .ctrl = true }, .{ .toggle_window_tags = tags });
}
}
{