srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/platform/src
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-05-13 20:11:00 +0200
committersrdusr <[email protected]>2026-05-13 20:11:00 +0200
commit8174ced0d9d42343b18072c64491ccb06632a75f (patch)
treee838ef26f28447c90440b3e7ff60aad342e0d1f3 /crates/platform/src
parent670c9845129fc0c4b6e0192d657eea05e1a64b49 (diff)
downloadsrdwm-8174ced0d9d42343b18072c64491ccb06632a75f.tar.gz
srdwm-8174ced0d9d42343b18072c64491ccb06632a75f.zip
Report whether a listed key binding is actually grabbed
Requested by the AGS session while wiring its launcher to srd keybindings: without this the launcher would list a shortcut that does nothing and give no way to tell, which is the same silent-lie class of bug as the rest of the work today. The backend is handed one combo list, once, before connecting - X11 turns it into XGrabKey calls, Wayland into its intercept set. A reload re-registers the actions but cannot re-register the grabs, so a combination added to the config since startup is bound as far as the config engine is concerned and still goes straight to the focused client when pressed. That snapshot is now recorded on the WindowManager at the exact point it is handed to the backend, taken once rather than per-arm so the reported set and the grabbed set cannot drift apart, and each entry in srd keybindings carries a `grabbed` flag. Verified live in a nested instance, both states observed: 46 bindings and 46 grabbed at startup; then appending a new combination to the config gave 47 bindings, 46 grabbed, with the new one reported as not grabbed and carrying its description. Two unit tests cover the set being replaced rather than accumulated, and a combo outside it reading as not grabbed. Also recorded, from the AGS session's own checks: moving a window to a workspace was their bug, not a missing compositor feature - the Overview's previews had a drop target and the bar's workspace dots had none, so the gesture worked on one surface and silently did nothing on the other. And the static half of "are all keybindings working" is clean for the running session: keybindings.lua was last modified 06:02:55 and the compositor started 18:11:13, so every combination in it was grabbed at boot. 517 tests pass, clippy clean.
Diffstat (limited to 'crates/platform/src')
-rw-r--r--crates/platform/src/ipc/dispatch.rs7
-rw-r--r--crates/platform/src/ipc/types.rs5
2 files changed, 10 insertions, 2 deletions
diff --git a/crates/platform/src/ipc/dispatch.rs b/crates/platform/src/ipc/dispatch.rs
index ad79b98..b0f0cba 100644
--- a/crates/platform/src/ipc/dispatch.rs
+++ b/crates/platform/src/ipc/dispatch.rs
@@ -424,8 +424,11 @@ pub(crate) fn handle_request(line: &[u8], wm: &std::rc::Rc<std::cell::RefCell<Wi
// outside this process could see a binding at all before this.
"keybindings" => {
let wm = wm.borrow();
- let list: Vec<KeybindingInfo> =
- wm.keybindings.iter().map(|(combo, description)| KeybindingInfo { combo: combo.clone(), description: description.clone() }).collect();
+ let list: Vec<KeybindingInfo> = wm
+ .keybindings
+ .iter()
+ .map(|b| KeybindingInfo { combo: b.combo.clone(), description: b.description.clone(), grabbed: b.grabbed })
+ .collect();
(serde_json::to_vec(&KeybindingsResponse { keybindings: list }).unwrap_or_default(), false)
}
"set" => handle_set(&req, wm),
diff --git a/crates/platform/src/ipc/types.rs b/crates/platform/src/ipc/types.rs
index 286df20..3243e31 100644
--- a/crates/platform/src/ipc/types.rs
+++ b/crates/platform/src/ipc/types.rs
@@ -129,6 +129,11 @@ pub(crate) struct MonitorsResponse {
pub(crate) struct KeybindingInfo {
pub(crate) combo: String,
pub(crate) description: String,
+ /// `false` when the config binds this combo but the compositor does not
+ /// actually intercept it - see `srdwm_core::KeyBinding::grabbed`. A UI
+ /// listing bindings should say so rather than showing a shortcut that
+ /// silently does nothing.
+ pub(crate) grabbed: bool,
}
#[derive(Serialize)]