mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-22 08:31:50 +01:00
feat(kwin): per-application key bindings follow the focus
skhd and whkd can give one key a different action in each application, or none (skhd's ~, whkd's Ignore), and skhd has a blacklist of applications in which no key is taken. The engine decides from the focused application whether such a key is active: inactive, it reaches the application, which is how a key passes through. What it needs is to be told which application has the focus. The bridge reports the desktop entry of every window with its class, and the table now keeps it. Table::focused_application returns the executable, the app id (or X11 class) and the desktop entry of the window KWin activated last, a dialog included, or nothing once that window is gone. The KWin backend hands it to kwin::hotkeys::focus after every event of the bridge; only a change reaches the engine's thread, and an engine that starts begins with the focus as it was last seen. The engine matches the names of the file against the three, ignoring case. The names in an skhdrc or a whkdrc are those of macOS and Windows applications, so the daemon takes --app-alias NAME=ALIAS[,ALIAS]..., more than once, for the engine's app_aliases. Unit tests cover the focus of the table and the calls of a scoped key as the focus moves, an alias included. The VM test vm-keys-engine grows a section with wev and foot open and --app-alias terminal=foot: in wev, Alt+G (for the terminal only) and Alt+N (which wev ignores) reach wev and run nothing; in foot both run their bindings; back in wev, Alt+G reaches wev again.
This commit is contained in:
1 parent
260d8ff03e
commit
47d3a471d7
7 files changed
+258
-7
No files matched your search
@@ -88,6 +88,17 @@ of an sxhkdrc (`alt + w ; h`) works the same way: after `alt + w`, only the keys
|
||||
come next and Escape are taken, until one of them is pressed or 3 seconds pass
|
||||
(`--chord-timeout 1500` waits 1.5 seconds instead).
|
||||
|
||||
A binding that does something else in each application (skhd's `[ ... ]` list, whkd's
|
||||
per-application list) takes its key only while an application it names has the focus, or
|
||||
any application for a `*` or `Default` entry; everywhere else the key reaches the application.
|
||||
A name matches the executable, the Wayland app id (`org.kde.konsole`) or the desktop entry of
|
||||
the focused window, whatever the case. skhd and whkd name applications as macOS and Windows
|
||||
do, so give the daemon the names they have on KDE:
|
||||
|
||||
```sh
|
||||
komorebic start -- --app-alias firefox=firefox-esr,librewolf --app-alias Terminal=konsole
|
||||
```
|
||||
|
||||
A daemon that is killed leaves its keys swallowed until it is started again; `komorebic stop`
|
||||
gives them back.
|
||||
|
||||
|
||||
Reference in new issue
Block a user