mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-30 20:24:09 +01:00
feat(cli): komorebic
The daemon answers on its socket, but a person has no way to write a message on it. komorebic is that way: each subcommand that asks something of the daemon is one message, sent with komorebi-client, and a question's answer is printed. komorebic is a separate program because the daemon takes no input but its socket, so a key binding, a script and a terminal all drive it the same way. It has what the daemon can answer so far: state, monitor-information, query, retile and stop. Around them, start runs the komorebi on the PATH in the background and passes it what follows a --, such as --fake-backend to try it without a compositor; log follows the daemon's log, which the daemon now writes to a file a day in LOG_DIR as well as to stdout; data-directory shows where the socket is; completions prints a shell completion script. The hidden docgen writes each subcommand's help to docs/cli, in fences that name their language and wrapped at 100 columns whatever the width of the terminal, so that the pages are the same wherever they are generated; just docgen runs it. The user guide starts here: docs/index.md for KDE Plasma, and a page on running komorebi. tests/cli.rs runs each subcommand against a socket the test serves in place of the daemon. In the VM tests the guests get komorebic next to the daemon, and vm-core-e2e reads the daemon's state with it (the windows it manages, the one it focuses, after KWin restarts too) and stops it with komorebic stop, which unloads the bridge and removes the socket. In the VM test library, Kde.state asks again, a second (times the scale) after an empty answer or a failed command, up to 10 times. The daemon drops a query when it cannot take hold of the window manager within a second, and komorebic then prints an empty line and succeeds; komorebic itself gives the daemon a second to answer and fails when that is not enough. A daemon busy with the first windows does either on a machine that is loaded or slow, and a suite that polled the state died on JSONDecodeError. An answer that is not JSON still fails at once.
This commit is contained in:
1 parent
88aa78b874
commit
6f657e53e3
36 files changed
+1320
-39
No files matched your search
+11
-6
@@ -144,9 +144,11 @@ What komorebi calls:
|
||||
|---|---|---|
|
||||
| `$XDG_RUNTIME_DIR/komorebi/bridge.js` | the script KWin loads, with its configuration (the D-Bus names and the hold time of `Poll`) on its first line | written at every start; the directory is removed at logout |
|
||||
| `$XDG_RUNTIME_DIR/komorebi/komorebi.sock` | the command socket | bound once the daemon is connected to KWin, after a file left there is removed; removed when the daemon stops |
|
||||
| `$XDG_DATA_HOME/komorebi/komorebi.log.YYYY-MM-DD` | the daemon's log, with colors, which `komorebic log` follows | a file a day (the UTC date), never removed by komorebi |
|
||||
| `$XDG_DATA_HOME/komorebi/komorebi_plaintext.log.YYYY-MM-DD` | the same log without colors | as above |
|
||||
|
||||
Without `XDG_RUNTIME_DIR` the directory is `komorebi` in the local data directory instead
|
||||
(see [`XDG_DATA_HOME`](#xdg_data_home)).
|
||||
Without `XDG_RUNTIME_DIR` the bridge and the socket are in `komorebi` in the local data
|
||||
directory instead, with the logs (see [`XDG_DATA_HOME`](#xdg_data_home)).
|
||||
|
||||
## Environment variables
|
||||
|
||||
@@ -163,8 +165,10 @@ the `komorebi` directory in it, and binds its command socket there.
|
||||
|
||||
### `XDG_DATA_HOME`
|
||||
|
||||
Read only when `XDG_RUNTIME_DIR` is not set: the bridge and the socket then go to
|
||||
`$XDG_DATA_HOME/komorebi` (`~/.local/share/komorebi` if `XDG_DATA_HOME` is not set either).
|
||||
The logs are written to `$XDG_DATA_HOME/komorebi` (`~/.local/share/komorebi` if
|
||||
`XDG_DATA_HOME` is not set), which the daemon makes before anything else: a home it cannot
|
||||
write to stops it at once. When `XDG_RUNTIME_DIR` is not set, the bridge and the socket go
|
||||
there too.
|
||||
|
||||
### `RUST_LOG`
|
||||
|
||||
@@ -178,8 +182,9 @@ Whether an error carries a backtrace. komorebi sets it to `1` when it is not set
|
||||
|
||||
### `NO_COLOR`
|
||||
|
||||
When set to anything but the empty string, the log has no ANSI colors, which is what a log
|
||||
written to a file wants. The VM tests set it.
|
||||
When set to anything but the empty string, the log the daemon prints on its standard output
|
||||
has no ANSI colors, which is what standard output redirected to a file wants. The VM tests
|
||||
set it. The log files are not affected: one has colors and the other none.
|
||||
|
||||
## The bridge's environment
|
||||
|
||||
|
||||
Reference in new issue
Block a user