From 9c1673fa73bb49433370a60a7b4bb16abee98a9b Mon Sep 17 00:00:00 2001 From: srdusr <99972264+srdusr@users.noreply.github.com> Date: Wed, 5 Aug 2026 00:55:00 +0200 Subject: Show a keybinding the way a person writes it, and let bind_repeat be described Measured with dotfiles-1a, who own the launcher that displays these: `srd keybindings` returned 84 bindings and 84 empty descriptions - 100% - so every entry their launcher showed was a bare key combo with nothing to say what it does. Two causes, one on each side of the boundary. `srd.bind_repeat` never accepted a description. `srd.bind` has taken an optional third argument all along, but its repeating sibling took only two, and mlua drops a surplus argument silently rather than raising - so a config that documented its repeat bindings got no error and no description. It now takes one exactly like `bind`. The combos themselves were reported in their internal dispatch form: `Shift+Mod4+h`. `Mod4` is the X11 modifier's name, not a key's; nothing on a keyboard is labelled Mod4, and the canonical Ctrl/Shift/Alt/Mod4 ordering renders the owner's own `Super+Shift+h` binding back to them inside out. `srd keybindings` now reports a display form - Super, and the order people write - while everything internal keeps the canonical form it dispatches on. The display form parses back to the same binding, so it can be pasted into a config, and a test pins that round trip rather than trusting it. The owner's own config now describes all 84 bindings; verified through the real path, in a nested compositor running that config: 84 of 84 described, zero occurrences of "Mod4". --- crates/platform/src/ipc/dispatch.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'crates/platform/src') diff --git a/crates/platform/src/ipc/dispatch.rs b/crates/platform/src/ipc/dispatch.rs index b0f0cba..49d8244 100644 --- a/crates/platform/src/ipc/dispatch.rs +++ b/crates/platform/src/ipc/dispatch.rs @@ -427,7 +427,17 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc = wm .keybindings .iter() - .map(|b| KeybindingInfo { combo: b.combo.clone(), description: b.description.clone(), grabbed: b.grabbed }) + // `display_key_combo`, not the stored combo: what is stored + // is the canonical dispatch key (`Shift+Mod4+h`), and a + // panel or launcher showing that verbatim is showing an X11 + // modifier name nothing on a keyboard is labelled with. The + // form here is what the owner wrote in their own config, and + // parses back to the same binding. + .map(|b| KeybindingInfo { + combo: srdwm_core::display_key_combo(&b.combo), + description: b.description.clone(), + grabbed: b.grabbed, + }) .collect(); (serde_json::to_vec(&KeybindingsResponse { keybindings: list }).unwrap_or_default(), false) } -- cgit v1.2.3