diff --git a/src/command.zig b/src/command.zig index 075e21f..add31ea 100644 --- a/src/command.zig +++ b/src/command.zig @@ -92,6 +92,18 @@ pub fn setFocusedViewTags(server: *Server, arg: Arg) void { } } +/// Toggle the passed tags of the focused view +pub fn toggleFocusedViewTags(server: *Server, arg: Arg) void { + const tags = arg.uint; + if (server.root.focused_view) |view| { + const new_tags = view.current_tags ^ tags; + if (new_tags != 0) { + view.pending_tags = new_tags; + server.root.arrange(); + } + } +} + /// Spawn a program. /// TODO: make this take a program as a paramter and spawn that pub fn spawn(server: *Server, arg: Arg) void { diff --git a/src/config.zig b/src/config.zig index 75c7f99..50ee7eb 100644 --- a/src/config.zig +++ b/src/config.zig @@ -65,5 +65,12 @@ pub const Config = struct { try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_4, .modifiers = mod | c.WLR_MODIFIER_CTRL, .command = command.toggleTags, .arg = .{ .uint = 1 << 3 } }); try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_5, .modifiers = mod | c.WLR_MODIFIER_CTRL, .command = command.toggleTags, .arg = .{ .uint = 1 << 4 } }); try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_6, .modifiers = mod | c.WLR_MODIFIER_CTRL, .command = command.toggleTags, .arg = .{ .uint = 1 << 5 } }); + + try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_1, .modifiers = mod | c.WLR_MODIFIER_CTRL | c.WLR_MODIFIER_SHIFT, .command = command.toggleFocusedViewTags, .arg = .{ .uint = 1 << 0 } }); + try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_2, .modifiers = mod | c.WLR_MODIFIER_CTRL | c.WLR_MODIFIER_SHIFT, .command = command.toggleFocusedViewTags, .arg = .{ .uint = 1 << 1 } }); + try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_3, .modifiers = mod | c.WLR_MODIFIER_CTRL | c.WLR_MODIFIER_SHIFT, .command = command.toggleFocusedViewTags, .arg = .{ .uint = 1 << 2 } }); + try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_4, .modifiers = mod | c.WLR_MODIFIER_CTRL | c.WLR_MODIFIER_SHIFT, .command = command.toggleFocusedViewTags, .arg = .{ .uint = 1 << 3 } }); + try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_5, .modifiers = mod | c.WLR_MODIFIER_CTRL | c.WLR_MODIFIER_SHIFT, .command = command.toggleFocusedViewTags, .arg = .{ .uint = 1 << 4 } }); + try self.keybinds.append(Keybind{ .keysym = c.XKB_KEY_6, .modifiers = mod | c.WLR_MODIFIER_CTRL | c.WLR_MODIFIER_SHIFT, .command = command.toggleFocusedViewTags, .arg = .{ .uint = 1 << 5 } }); } };