srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/config/srd
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-05-13 19:47:00 +0200
committersrdusr <[email protected]>2026-05-13 19:47:00 +0200
commit670c9845129fc0c4b6e0192d657eea05e1a64b49 (patch)
tree273573d7ed109af3d39e268a6d43787b831c9d47 /config/srd
parent646b37e7e3aa5931079c6b9e804f420bb43c74d5 (diff)
downloadsrdwm-670c9845129fc0c4b6e0192d657eea05e1a64b49.tar.gz
srdwm-670c9845129fc0c4b6e0192d657eea05e1a64b49.zip
Expose key bindings over IPC so a launcher can list them
Asked whether srdwm's bindings show in the AGS launcher. They could not: srd.bind lives entirely in the Lua engine, and nothing published a binding anywhere a client could read it. There was no IPC command, no field in any response, and bound_keys() was used only by main.rs to register grabs. srd.bind now takes an optional third argument, a description, and the loaded set is copied into the WindowManager after the initial load and after every reload. Core neither owns nor interprets them - it has no Lua state and never dispatches a key - it holds them so the IPC layer, which is handed a WindowManager and nothing else, can serve them. New `srd keybindings` returns combo and description pairs, sorted so a UI listing them does not reshuffle on every refresh. Every binding in the shipped config now carries a description, so the feature is useful without the user writing any. Verified live in a nested instance: 46 bindings published, 0 without a description, and editing the config file updated the list without a restart (which also exercised reload-on-write again). Also verified, for the separate report that windows cannot be moved to another workspace from the AGS workspace pills: the compositor side works. `srd dispatch move workspace <id> 2` moved a window from workspace 1 to 2 and correctly hid it, since workspace 1 was active. Nothing to fix here; the missing piece is on the shell side. 515 tests pass, clippy clean.
Diffstat (limited to 'config/srd')
-rw-r--r--config/srd/keybindings.lua56
1 files changed, 28 insertions, 28 deletions
diff --git a/config/srd/keybindings.lua b/config/srd/keybindings.lua
index aa3e425..dc315e9 100644
--- a/config/srd/keybindings.lua
+++ b/config/srd/keybindings.lua
@@ -21,25 +21,25 @@ srd.bind("Mod4+3", function()
end)
- Window management (act on the focused window)
-srd.bind("Mod4+q", function() srd.window.close() end)
-srd.bind("Mod4+m", function() srd.window.minimize() end)
-srd.bind("Mod4+f", function() srd.window.maximize() end)
-srd.bind("Mod4+Shift+space", function() srd.window.toggle_floating() end)
+srd.bind("Mod4+q", function() srd.window.close() end, "Close the focused window")
+srd.bind("Mod4+m", function() srd.window.minimize() end, "Minimize the focused window")
+srd.bind("Mod4+f", function() srd.window.maximize() end, "Maximize or restore the focused window")
+srd.bind("Mod4+Shift+space", function() srd.window.toggle_floating() end, "Float or unfloat the focused window")
- Window navigation (vim-style directional focus)
-srd.bind("Mod4+h", function() srd.window.focus("left") end)
-srd.bind("Mod4+j", function() srd.window.focus("down") end)
-srd.bind("Mod4+k", function() srd.window.focus("up") end)
-srd.bind("Mod4+l", function() srd.window.focus("right") end)
+srd.bind("Mod4+h", function() srd.window.focus("left") end, "Focus the window to the left")
+srd.bind("Mod4+j", function() srd.window.focus("down") end, "Focus the window to the down")
+srd.bind("Mod4+k", function() srd.window.focus("up") end, "Focus the window to the up")
+srd.bind("Mod4+l", function() srd.window.focus("right") end, "Focus the window to the right")
- Move the focused window in a direction, mirroring the focus keys above.
- `srd.window.move` has existed for a long time and simply had no default
- binding, so "move window to absolute directions" was unreachable without
- writing your own config.
-srd.bind("Mod4+Shift+h", function() srd.window.move("left") end)
-srd.bind("Mod4+Shift+j", function() srd.window.move("down") end)
-srd.bind("Mod4+Shift+k", function() srd.window.move("up") end)
-srd.bind("Mod4+Shift+l", function() srd.window.move("right") end)
+srd.bind("Mod4+Shift+h", function() srd.window.move("left") end, "Move the window left")
+srd.bind("Mod4+Shift+j", function() srd.window.move("down") end, "Move the window down")
+srd.bind("Mod4+Shift+k", function() srd.window.move("up") end, "Move the window up")
+srd.bind("Mod4+Shift+l", function() srd.window.move("right") end, "Move the window right")
- Layout switching. srdwm is dynamic-first: "dynamic" is free placement,
- the default, and tiling is one opt-in layout among several. Mod4+s
@@ -50,30 +50,30 @@ srd.bind("Mod4+s", function()
else
srd.layout.set("tiling")
end
-end)
+end, "Toggle tiling and dynamic layout")
- Lock the session using srdwm's own built-in lock screen. `srd.lock()`
- talks to the compositor directly rather than shelling out to the control
- CLI, so it still works when that binary is not on PATH.
-srd.bind("Mod4+Ctrl+l", function() srd.lock() end)
+srd.bind("Mod4+Ctrl+l", function() srd.lock() end, "Lock the session")
- Workspace management
-srd.bind("Mod4+Tab", function() srd.workspace.next() end)
-srd.bind("Mod4+Shift+Tab", function() srd.workspace.prev() end)
+srd.bind("Mod4+Tab", function() srd.workspace.next() end, "Next workspace")
+srd.bind("Mod4+Shift+Tab", function() srd.workspace.prev() end, "Previous workspace")
- Workspace switching with number keys (0 doubles as "workspace 10")
for i = 0, 9 do
- srd.bind("Mod4+" .. i, function() srd.workspace.switch(i) end)
- srd.bind("Mod4+Shift+" .. i, function() srd.workspace.move_window(i) end)
+ srd.bind("Mod4+" .. i, function() srd.workspace.switch(i) end, "Switch to workspace " .. i)
+ srd.bind("Mod4+Shift+" .. i, function() srd.workspace.move_window(i) end, "Move window to workspace " .. i)
end
- Quick actions
-srd.bind("Mod4+d", function() srd.spawn("rofi -show drun") end)
-srd.bind("Mod4+Return", function() srd.spawn("alacritty") end)
-srd.bind("Mod4+r", function() srd.spawn("rofi -show run") end)
+srd.bind("Mod4+d", function() srd.spawn("rofi -show drun") end, "Application launcher")
+srd.bind("Mod4+Return", function() srd.spawn("alacritty") end, "Open a terminal")
+srd.bind("Mod4+r", function() srd.spawn("rofi -show run") end, "Run a command")
- System
-srd.bind("Mod4+Shift+q", function() srd.quit() end)
+srd.bind("Mod4+Shift+q", function() srd.quit() end, "Quit srdwm")
- Custom function example: toggle window gaps at runtime
local function toggle_gaps()
@@ -85,13 +85,13 @@ local function toggle_gaps()
srd.notify("Gaps: On", "info")
end
end
-srd.bind("Mod4+g", toggle_gaps)
+srd.bind("Mod4+g", toggle_gaps, "Toggle window gaps")
- Media keys
-srd.bind("XF86AudioRaiseVolume", function() srd.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%") end)
-srd.bind("XF86AudioLowerVolume", function() srd.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%") end)
-srd.bind("XF86AudioMute", function() srd.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle") end)
-srd.bind("XF86MonBrightnessUp", function() srd.spawn("brightnessctl set +5%") end)
-srd.bind("XF86MonBrightnessDown", function() srd.spawn("brightnessctl set 5%-") end)
+srd.bind("XF86AudioRaiseVolume", function() srd.spawn("pactl set-sink-volume @DEFAULT_SINK@ +5%") end, "Volume up")
+srd.bind("XF86AudioLowerVolume", function() srd.spawn("pactl set-sink-volume @DEFAULT_SINK@ -5%") end, "Volume down")
+srd.bind("XF86AudioMute", function() srd.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle") end, "Mute")
+srd.bind("XF86MonBrightnessUp", function() srd.spawn("brightnessctl set +5%") end, "Brightness up")
+srd.bind("XF86MonBrightnessDown", function() srd.spawn("brightnessctl set 5%-") end, "Brightness down")
print("Key bindings configuration loaded")