From 522e2ec67483219c04492790b2ef8ee2d8359418 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Mon, 11 Nov 2024 15:44:41 +0100 Subject: [PATCH] river: implement scratchpad --- .config/waybar/config.jsonc.cgt | 2 ++ scripts/mzteriver/src/init.zig | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.config/waybar/config.jsonc.cgt b/.config/waybar/config.jsonc.cgt index b9507bc..79c39fb 100644 --- a/.config/waybar/config.jsonc.cgt +++ b/.config/waybar/config.jsonc.cgt @@ -34,6 +34,8 @@ end :battery :clock :tray] + :river/tags {:num-tags 10 + :tag-labels [:1 :2 :3 :4 :5 :6 :7 :8 :9 :S]} :cava {:hide_on_silence true :bars 16 :bar_delimiter 0 diff --git a/scripts/mzteriver/src/init.zig b/scripts/mzteriver/src/init.zig index 4a30364..a64135f 100644 --- a/scripts/mzteriver/src/init.zig +++ b/scripts/mzteriver/src/init.zig @@ -44,7 +44,7 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void { .{ "None", "XF86AudioPlay", "spawn", journal_prefix ++ opt.commands.media.play_pause }, .{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ opt.commands.media.prev }, .{ "None", "XF86AudioNext", "spawn", journal_prefix ++ opt.commands.media.next }, - + // light control .{ "None", "XF86MonBrightnessUp", "spawn", journal_prefix ++ opt.commands.backlight_up }, .{ "None", "XF86MonBrightnessDown", "spawn", journal_prefix ++ opt.commands.backlight_down }, @@ -134,6 +134,17 @@ pub fn init(alloc: std.mem.Allocator, initial: bool) !void { try con.runCommand(&[_][:0]const u8{ "input", "*" } ++ cmd); } + // scratchpad + { + var pbuf: [64]u8 = undefined; + const scratchpad_tag: u32 = 1 << 9; + try con.runCommand(&.{ "spawn-tagmask", try std.fmt.bufPrintZ(&pbuf, "{}", .{~scratchpad_tag}) }); + + const tag_s = try std.fmt.bufPrintZ(&pbuf, "{}", .{scratchpad_tag}); + try con.runCommand(&.{ "map", "normal", "Super", "P", "toggle-focused-tags", tag_s }); + try con.runCommand(&.{ "map", "normal", "Super+Shift", "P", "set-view-tags", tag_s }); + } + // tag config for (0..9) |i| { var key_buf: [16]u8 = undefined;