mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-21 16:11:37 +01:00
feat(cli): turn key binding files into KDE static shortcuts
komorebi users keep their bindings to komorebic in a file of skhd, whkd or sxhkd. On Plasma under Wayland no client sees the keys of another, and the program that runs a command on a key is KDE's global shortcut daemon, which runs inside KWin. A binding that is one combo, pressed, the same in every application, in a file without modes, can be a static shortcut: a .desktop file that KWin reads by itself, that shows in System Settings and that works with no komorebi process at all. komorebic hotkeys compile reads a file of any of the three formats, plans it with komorebi-hotkeys in the mode it is given (auto, engine or static; the default is the crate's), prints the diagnostics of reading and planning, and writes the static shortcuts to $XDG_DATA_HOME/kglobalaccel or --output, replacing the files it wrote before and no other. --strict refuses a file with a warning or an error before writing anything, --dry-run says what a write would change, and --reload hands each new file to the running KWin. komorebic export-kde-shortcuts keeps the spike's interface for an skhdrc, in the static mode. Both are thin: the reading, the plan and the files are the crate's. The bindings that need the engine are counted; the daemon does not run them yet. docgen gives a subcommand of a subcommand a page of its own (hotkeys-compile.md). KOMOREBI_CONFIG_HOME, or ~/.config/komorebi, is where komorebic looks for a file it is not given. komorebic check gains a section for the key bindings, between the configuration and the desktop: the first key binding file of the config home, how many bindings it has and where they go, the lines that cannot be read (a warning, and the first five) and the bindings not realized as their own daemon would (a note), and whether the generated files in the shortcut directory are the ones hotkeys compile would write now (a warning with how many to add, to change and to remove). --configuration-only keeps it, as it looks at files. The VM test vm-keys-static boots a Plasma session with shortcut files that hotkeys compile wrote into the system profile at build time, presses their keys through QEMU's keyboard, and sees each command run, a % in one of them included; then it writes a binding in the middle of the session with export-kde-shortcuts --reload and presses it. The library gains Keys, which sends a combo as KDE writes it through QEMU's sendkey.
This commit is contained in:
1 parent
a2e7f12bd3
commit
e1a227434b
27 files changed
+1585
-36
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ Options:
|
||||
Path to a static configuration JSON file
|
||||
|
||||
--configuration-only
|
||||
Look at the configuration only, not at the desktop
|
||||
Look at the configuration and the key bindings only, not at the desktop
|
||||
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
```text
|
||||
Turn an skhdrc into KDE global shortcuts (they work over RDP, unlike evdev hotkey daemons)
|
||||
|
||||
Usage: export-kde-shortcuts [OPTIONS]
|
||||
|
||||
Options:
|
||||
-s, --skhdrc <SKHDRC>
|
||||
The skhdrc to translate [default: skhdrc in the komorebi config directory]
|
||||
|
||||
-o, --output <OUTPUT>
|
||||
Where to write the shortcut files [default: $XDG_DATA_HOME/kglobalaccel]
|
||||
|
||||
--reload
|
||||
Activate shortcuts that are new straight away, instead of at the next login
|
||||
|
||||
--dry-run
|
||||
Show the shortcuts that would be written without writing anything
|
||||
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
```text
|
||||
Plan the bindings of a key binding file, and write those that are static shortcuts as KDE shortcut
|
||||
files
|
||||
|
||||
Usage: compile [OPTIONS] [FILE]
|
||||
|
||||
Arguments:
|
||||
[FILE]
|
||||
The key binding file [default: the first of skhdrc, whkdrc and sxhkdrc in the komorebi
|
||||
config directory]
|
||||
|
||||
Options:
|
||||
-f, --format <FORMAT>
|
||||
The format of the file [default: from the end of its name: skhdrc, whkdrc or sxhkdrc]
|
||||
|
||||
[possible values: skhd, whkd, sxhkd]
|
||||
|
||||
-m, --mode <MODE>
|
||||
Which bindings are static shortcuts: none (engine), every binding a shortcut file can
|
||||
express (auto), or only those, leaving the others out (static)
|
||||
|
||||
[default: engine]
|
||||
[possible values: auto, engine, static]
|
||||
|
||||
-o, --output <OUTPUT>
|
||||
Where to write the shortcut files [default: $XDG_DATA_HOME/kglobalaccel]
|
||||
|
||||
--strict
|
||||
Write nothing, and fail, when a diagnostic is a warning or an error: something in the file
|
||||
is not realized the way its own hotkey daemon realizes it
|
||||
|
||||
--reload
|
||||
Activate shortcuts that are new straight away, instead of at the next login
|
||||
|
||||
--dry-run
|
||||
Show the shortcuts that would be written without writing anything
|
||||
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
```text
|
||||
Turn a key binding file (skhdrc, whkdrc, sxhkdrc) into KDE global shortcuts
|
||||
|
||||
Usage: hotkeys <COMMAND>
|
||||
|
||||
Commands:
|
||||
compile Plan the bindings of a key binding file, and write those that are static shortcuts as KDE
|
||||
shortcut files
|
||||
help Print this message or the help of the given subcommand(s)
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Print help
|
||||
|
||||
```
|
||||
Reference in new issue
Block a user