mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-29 03:42:46 +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
@@ -54,8 +54,8 @@ own Wayland socket), so a test can run several sessions side by side and none
|
||||
touches another. A virtual KWin has no real output, so it cannot draw: it can
|
||||
place windows and answer questions about them, but it cannot take a screenshot.
|
||||
A third unit, `komorebi@NAME`, runs the daemon in a session, built from the
|
||||
commit under test and installed on the node; it is not bound to KWin's unit, so
|
||||
a test can restart KWin under a running daemon.
|
||||
commit under test and installed on the node with `komorebic`; it is not bound to
|
||||
KWin's unit, so a test can restart KWin under a running daemon.
|
||||
|
||||
KWin wants a DRM render node, which needs a GPU. The test driver gives every aarch64 guest one
|
||||
`virtio-gpu-pci`; on x86_64 the node adds it, unless `komorebi.vm.renderNode` is false.
|
||||
@@ -105,6 +105,11 @@ the run.
|
||||
started, and `script_loaded()` asks KWin whether it runs the bridge.
|
||||
`restart_kwin()` stops the session's KWin and starts a new one on the same
|
||||
bus, as when the compositor of a running session crashes, and waits for it.
|
||||
- `komorebic(*args)` runs `komorebic` in the session and returns what it
|
||||
printed, failing the test if it fails. `state()` is the daemon's state as
|
||||
`komorebic state` prints it, `managed(workspace)` the number of windows the
|
||||
daemon has on a workspace of the first monitor, and `focused_title(workspace)`
|
||||
the title of the window it has focused there.
|
||||
- `daemon` reads the daemon's view of the desktop from that log, started with
|
||||
`--log-level debug`: `daemon.events(log)` lists the window events it handled,
|
||||
in order, `daemon.window_ids(log)` maps a window's title to the daemon's id
|
||||
|
||||
Reference in new issue
Block a user