river: implement scratchpad

This commit is contained in:
LordMZTE 2024-11-11 15:44:41 +01:00
parent 7aa0d88ecd
commit 522e2ec674
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
2 changed files with 14 additions and 1 deletions

View file

@ -34,6 +34,8 @@ end
:battery :battery
:clock :clock
:tray] :tray]
:river/tags {:num-tags 10
:tag-labels [:1 :2 :3 :4 :5 :6 :7 :8 :9 :S]}
:cava {:hide_on_silence true :cava {:hide_on_silence true
:bars 16 :bars 16
:bar_delimiter 0 :bar_delimiter 0

View file

@ -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", "XF86AudioPlay", "spawn", journal_prefix ++ opt.commands.media.play_pause },
.{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ opt.commands.media.prev }, .{ "None", "XF86AudioPrev", "spawn", journal_prefix ++ opt.commands.media.prev },
.{ "None", "XF86AudioNext", "spawn", journal_prefix ++ opt.commands.media.next }, .{ "None", "XF86AudioNext", "spawn", journal_prefix ++ opt.commands.media.next },
// light control // light control
.{ "None", "XF86MonBrightnessUp", "spawn", journal_prefix ++ opt.commands.backlight_up }, .{ "None", "XF86MonBrightnessUp", "spawn", journal_prefix ++ opt.commands.backlight_up },
.{ "None", "XF86MonBrightnessDown", "spawn", journal_prefix ++ opt.commands.backlight_down }, .{ "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); 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 // tag config
for (0..9) |i| { for (0..9) |i| {
var key_buf: [16]u8 = undefined; var key_buf: [16]u8 = undefined;