mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-05 06:26:30 +01:00
feat(hotkeys): the engine as a pure state machine
What a static shortcut file cannot be (modes, chord chains, release bindings, per-application bindings, a blacklist, a pause binding) komorebi realizes itself, with keys it registers in kglobalacceld. The engine is the logic of that, with no I/O and no clock: it takes the press and the release of an active combo, a change of the focused window and the time, and returns effects: combos to activate or deactivate, and commands to run (komorebic's to dispatch in-process, the others through `sh -c`). After every event it computes the set of combos it wants from its state (the mode, the chord chain being typed, the focused application, whether it is paused) and returns the difference with the active set, so that a key it does not want reaches the application. That is how everything works, because of what KWin 6.8.1 was measured to do: KDE's own multi-key sequences never fire, while a single combo can be grabbed and given back (`setShortcutKeys`, `setInactive`) in well under a millisecond each. A chain's first combo is an active key, and pressing it leaves only the next combos and Escape active until one is pressed or the chord timeout (3 s by default) passes. A scoped key is active only while the focused application, matched without regard to case on its executable, app_id or desktop entry and on the configured aliases, has an action for it. Autorepeat arrives as a separate signal the engine has no input for, so a held key runs its binding once. The D-Bus side (registering the component, carrying out the effects, feeding the signals in) belongs to the daemon and is not here. The crate documentation now ends with what is emulated and what is not, across the readers, the plan and the engine.
This commit is contained in:
1 parent
8f5d4a32ef
commit
a2e7f12bd3
6 files changed
+837
-8
No files matched your search
@@ -92,9 +92,10 @@ without a checkout of the toolchain.
|
||||
daemon, reads its answers, subscribes to its notifications, and re-exports
|
||||
the types they are made of.
|
||||
- [`komorebi-hotkeys`](komorebi-hotkeys): reads the key binding files of skhd,
|
||||
whkd and sxhkd into one model, with the keys as KDE stores them, and plans
|
||||
each binding as a KDE shortcut file or as a key komorebi registers itself. It
|
||||
does not depend on the daemon. Its tests read the files in
|
||||
whkd and sxhkd into one model, with the keys as KDE stores them, plans each
|
||||
binding as a KDE shortcut file or as a key komorebi registers itself, and has
|
||||
the engine that decides, with no I/O of its own, which keys komorebi holds
|
||||
and what each press does. It does not depend on the daemon. Its tests read the files in
|
||||
[`komorebi-hotkeys/tests/fixtures`](komorebi-hotkeys/tests/fixtures), where
|
||||
each case is written in every format that can express it.
|
||||
- [`komorebic`](komorebic): the command line. A subcommand that asks something
|
||||
|
||||
Reference in new issue
Block a user