feat(kwin): realize the modes of a key binding file in the daemon

skhd's modes, and sxhkd's chains that stay open, are sets of keys that are
active together; a static shortcut cannot be in one. The engine already computes
the keys a mode wants. What the daemon adds is that a mode switch reaches
kglobalaccel as it should: the keys of the mode left are let go with
setInactive, so that they reach the focused window again, and those of the mode
entered are grabbed, bare keys included, before the next key arrives. It logs
the mode after each change, which is the one way to see from outside which mode
the engine is in.

A unit test follows the calls of entering a mode and leaving it with Escape. The
VM test vm-keys-engine grows a section with wev focused: in the default mode a
bare H reaches wev; Alt+R enters the mode resize and runs its command, after
which H runs its binding and does not reach wev; Escape goes back, and H reaches
wev again. That turns "a key the engine does not want reaches the application"
from a convention into a proved rule.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:21:14 -07:00
1 parent b49c4fab0a
commit 3f72eb84d1
5 files changed
+116 -4

No files matched your search

+4
View File
@@ -81,6 +81,10 @@ komorebic hotkeys compile --mode auto
komorebic start -- --keybindings-mode auto
```
The daemon realizes the modes of an skhdrc (and the chains of an sxhkdrc that stay open)
itself: while a mode is active, only its keys are taken, and every other key reaches the
window as usual. The log says which mode the daemon is in after each change.
A daemon that is killed leaves its keys swallowed until it is started again; `komorebic stop`
gives them back.