Files
komorebi/docs/usage/running-komorebi.md
T
LGUG2Z 44f7236698 feat(cli): check the desktop
komorebi fails quietly when the desktop is not what it was made for: over ssh
there is no session bus, a daemon whose script is not in KWin tiles nothing
while it runs, and komorebi needs KWin 6. `komorebic check` now looks at the
desktop after the configuration, and `--configuration-only` leaves that out for
a machine that is not the one komorebi will run on.

It looks at the session (KDE, Wayland), the session bus, KWin on it and KWin's
version, the daemon and its script (the daemon is running when its socket takes
a connection, the script is in KWin when KWin says it has loaded it), and what
starts komorebi at login. A bus that cannot be connected to or does not answer,
and no KWin on it, are errors, and the looking stops there because nothing after
them can be answered. Every call has two seconds to answer, so a bus that never
does cannot hold the check.

The test of the missing session bus used to remove the address and the runtime
directory from the environment and so depended on it: a machine with a user bus
at /run/user/UID/bus answered it. It now gives an address with no socket behind
it. A bus that accepts and never answers, the autostart finding and
--configuration-only have tests too, and the VM suite vm-check runs the command
against a real KWin with the daemon running, with its script gone, with no
daemon and with no KWin on the bus.

It also looks at the two effects KWin draws and animates with, and at the Plasma
shell. Only komorebi's builds of them do everything komorebi asks (a color for
each kind of window, every animation style), so the check tells a build by what
it contains: the interface of the border effect in its plugin file or its object
on the bus, a Curve setting in the animation effect's script. It looks for them
where KWin looks, from KWin's own environment, and a stock effect is a warning
only when the configuration asks for what it cannot do (borders, an animation
style other than the stock curve), and so is a copy in the user's own data
directory that hides komorebi's. The Plasma shell is looked for when the file
has wallpapers. vm-check runs all of it against KWin.
2026-10-28 07:20:57 -07:00

5.2 KiB

Running komorebi

komorebi is the daemon that tiles your windows, and komorebic is the command line you control it with. This page covers starting and stopping the daemon, asking it what it is doing, and reading its log.

Getting the two programs

Installing komorebi covers NixOS, where the flake's module installs both and starts the daemon with every Plasma session, and building them from source. In a checkout of the repository, on Linux, nix build leaves them in result/bin, and nix profile install . puts them on your PATH. Without nix, build them with the Rust toolchain that rust-toolchain.toml selects:

cargo build --release --locked
export PATH="$PWD/target/release:$PATH"

With the NixOS module, the daemon is the user unit komorebi.service, which starts when you log in to Plasma. systemctl --user start komorebi starts it again after a komorebic stop, and journalctl --user -u komorebi shows what it wrote. Everything else on this page applies to it as it is.

Starting and stopping

komorebic start runs the komorebi on your PATH in the background, and checks three seconds later that it is running. It tries three times. If komorebi has not started by then, komorebic start runs it once more in the foreground and prints what it wrote on its standard error, which explains why it did not start. When a komorebi is running already, komorebic start does nothing.

komorebi manages the windows of the Plasma Wayland session it is started in: it connects to KWin on the session bus and loads a script into it, so start it from a terminal in that session. Outside a Plasma session it exits with an error that says what is missing, which komorebic start prints. komorebic check says what is missing from the session, and what is wrong with the configuration, without starting anything.

--config gives the daemon the komorebi.json to read (Configuration says where it looks otherwise), and komorebic quickstart writes one to start from:

komorebic start --config ~/mine.json

Everything after a -- is passed to komorebi. --fake-backend runs it against an in-memory desktop with one monitor and no windows instead of KWin, which is a way to try the daemon and komorebic without a compositor:

komorebic start
komorebic start -- --log-level debug
komorebic start -- --fake-backend

komorebic stop tells the daemon to stop. It brings back the windows it hid (the back of a stack, stacking windows, and the windows behind a monocle), removes the desktop they were hidden on, asks KWin to unload its script, removes its socket and exits. Stopping the process with SIGINT or SIGTERM does the same.

Asking komorebi what it is doing

The daemon answers questions on its socket, and these commands print the answers:

  • komorebic state: every monitor, with its workspaces, their containers and the windows in them, as JSON.
  • komorebic monitor-information: the id, the name and the bounds of every monitor, as JSON.
  • komorebic query: one value, the answer to one question: the index of the focused monitor, workspace, container or window, the layout of the focused workspace, whether the focused container is a single window or a stack, or the version of the daemon.
komorebic query focused-workspace-index
komorebic state | jq '.monitors.elements[0].workspaces.elements[0].containers.elements | length'

komorebic retile tiles the windows of every monitor again, which puts a window that was moved by hand back on its tile.

When the daemon is not running, these commands fail: there is no socket to write to.

A program that wants to know what komorebi does without asking can subscribe to its notifications instead (Subscribing to notifications).

The socket and the data directory

The daemon listens on komorebi.sock in its data directory, $XDG_RUNTIME_DIR/komorebi (the local data directory, ~/.local/share/komorebi, when there is no runtime directory). komorebic data-directory prints the directory, if it exists.

The log

The daemon logs to its standard output and to a file a day in ~/.local/share/komorebi ($XDG_DATA_HOME/komorebi when that is set): komorebi.log.YYYY-MM-DD, with colors, and komorebi_plaintext.log.YYYY-MM-DD, without. The day is the UTC date.

komorebic log follows the file of the current day, with colors, until you press Ctrl-C. The --log-level of komorebi sets how much is logged: error, warn, info (the default), debug or trace.

Shell completions

komorebic completions prints a completion script for bash, elvish, fish, PowerShell or zsh:

komorebic completions fish > ~/.config/fish/completions/komorebic.fish
komorebic completions bash > ~/.local/share/bash-completion/completions/komorebic

Every command

docs/cli has a page for every komorebic command, generated from its help with just docgen.