From e29c4d01e14b290fc6466fbdd173289327f82b24 Mon Sep 17 00:00:00 2001 From: Ben Buhse Date: Wed, 11 Feb 2026 13:01:12 -0600 Subject: [PATCH] Add support for 'None' modifier for keybinds This is mostly useful for media and brightness keys, but could be used for other stuff, too. --- README.md | 20 +++++++++----------- examples/config.kdl | 11 +++++++++++ src/utils.zig | 4 +++- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index beaa325..44be31f 100644 --- a/README.md +++ b/README.md @@ -10,20 +10,18 @@ SPDX-License-Identifier: GPL-3.0-or-later These are in rough order of my priority, though no promises I do them in this order. -- [ ] Support `None` modifier for keybinds (needed for media/brightness keys) -- [ ] Support per-host config using properties (maybe also per-output?) -- [ ] Add input configuration, i.e. pointer acceleration and that type of thing -- [ ] Support a basic bar -- [ ] Support starting programs at WM launch +- [ ] Support per-host config using properties +- [ ] Implement an optional clock bar +- [ ] Implement a rivertile clone - [ ] Support overriding config location -- [ ] Add support for multimedia/brightness keys (this might not be neccesary) - [ ] Support window rules (float/tags/SSD by app-id/title) - [ ] Support switch handling (e.g. lid close) +- [ ] Support keybind modes (e.g. passthrough) +- [ ] Support solid `background-color` fallback (no wallpaper) +- [ ] Support per-output wallpapers +- [ ] Support `focus-follows-cursor` granularity (`normal` vs `always`) - [ ] Support multiple seats - [ ] Support clipping floating windows on edge of/between outputs -- [ ] Support keybind modes (e.g. passthrough) -- [ ] Support `focus-follows-cursor` granularity (`normal` vs `always`) -- [ ] Support solid `background-color` fallback (no wallpaper) - [x] Support changeable primary ratio - [x] Support changeable primary count - [x] Support multiple outputs @@ -31,5 +29,5 @@ These are in rough order of my priority, though no promises I do them in this or - [x] Support wallpapers - [x] Make "orelse return" bits into errors; handle gracefully - [x] Implement runtime log levels -- [ ] Switch all structs to idiomatic Zig init/deinit pattern (init returns value, caller decides stack/heap) - - I'm not sure I really need this +- [x] Add input configuration, i.e. pointer acceleration and that type of thing +- [x] Support `None` modifier for keybinds (needed for media/brightness keys) diff --git a/examples/config.kdl b/examples/config.kdl index 5451cf1..867fff6 100644 --- a/examples/config.kdl +++ b/examples/config.kdl @@ -55,6 +55,17 @@ keybinds { resize_height Mod4+Alt+Shift J 100 resize_height Mod4+Alt+Shift K -100 resize_width Mod4+Alt+Shift L 100 + // Media keys (no modifier) + spawn None XF86AudioRaiseVolume "~/.config/river/volume-up.sh" + spawn None XF86AudioLowerVolume "~/.config/river/volume-down.sh" + spawn None XF86AudioMute "~/.config/river/volume-toggle-mute.sh" + spawn None XF86AudioMedia "playerctl play-pause" + spawn None XF86AudioPlay "playerctl play-pause" + spawn None XF86AudioPrev "playerctl previous" + spawn None XF86AudioNext "playerctl next" + // Brightness keys (no modifier) + spawn None XF86MonBrightnessUp "~/.config/river/brightness-up.sh" + spawn None XF86MonBrightnessDown "~/.config/river/brightness-down.sh" // Special command to generate keybinds for keys 1-9 and tags 1<<0 through 1<<9 tag_bind Mod4 set_output_tags tag_bind Mod4+Shift set_window_tags diff --git a/src/utils.zig b/src/utils.zig index f2de860..f43e137 100644 --- a/src/utils.zig +++ b/src/utils.zig @@ -82,7 +82,9 @@ pub fn parseModifiers(s: []const u8) !?river.SeatV1.Modifiers { const lower = try std.ascii.allocLowerString(utils.allocator, part); defer utils.allocator.free(lower); - if (mem.eql(u8, lower, "mod4") or mem.eql(u8, lower, "super")) { + if (mem.eql(u8, lower, "none")) { + // No modifier bits to set + } else if (mem.eql(u8, lower, "mod4") or mem.eql(u8, lower, "super")) { modifiers.mod4 = true; } else if (mem.eql(u8, lower, "shift")) { modifiers.shift = true;