feat(wm): configuration in komorebi.json

The daemon takes its settings from a komorebi.json: the file --config names, or
the one in the config home ($KOMOREBI_CONFIG_HOME, else ~/.config/komorebi).
Without a file it runs on its defaults, as before.

StaticConfig reads the file in three steps, because the monitors are known only
after the backend has been asked. preload makes the window manager and applies
the settings that are process-wide, postload gives each monitor and workspace
the entry of its place (by the index display_index_preferences gives a monitor's
serial number id, else in order), and main asks KWin for a desktop for each
workspace the file lists. A watcher on the file sends the daemon a
ReloadStaticConfiguration about two seconds after it changes, whether an editor
wrote the file in place or renamed a new one over it, and a file that does not
parse changes nothing.

A workspace can change its layout, its work area offset and its layout options
with the number of its containers, from the file or with komorebic
(workspace-layout-rule, its named form and the two that clear), and
layout_defaults gives every workspace of a layout the options it sets none of.
One file is meant to serve every platform, so a key that does nothing on Plasma
is accepted and ignored. config_parity checks the example and the files of other
platforms; the keys of features that are not in yet are listed there, and the
test fails when a list names a key that is read.

The file also sets what the stacks, the float override, the floating layer and
monocle set while the daemon runs: window_container_behaviour, with its rules by
container count in a workspace, float_override, float_override_placement,
floating_layer_behaviour (for a monitor and a workspace too),
floating_layer_placement and monocle_focus_behaviour. Their features come before
this commit, but a file to put the keys in does not, so they are part of this
one.

komorebic gains configuration, generate-static-config and start --config. The
NixOS module gets configFile, which the unit gives the daemon as --config.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent 12b0aa9301
commit 5eaa613f50
49 files changed
+4778 -59

No files matched your search

@@ -0,0 +1,14 @@
```text
Clear all dynamic layout rules for the specified workspace
Usage: clear-named-workspace-layout-rules <WORKSPACE>
Arguments:
<WORKSPACE>
Target workspace name
Options:
-h, --help
Print help
```
+17
View File
@@ -0,0 +1,17 @@
```text
Clear all dynamic layout rules for the specified workspace
Usage: clear-workspace-layout-rules <MONITOR> <WORKSPACE>
Arguments:
<MONITOR>
Monitor index (zero-indexed)
<WORKSPACE>
Workspace index on the specified monitor (zero-indexed)
Options:
-h, --help
Print help
```
+10
View File
@@ -0,0 +1,10 @@
```text
Show the path to komorebi.json
Usage: configuration
Options:
-h, --help
Print help
```
+10
View File
@@ -0,0 +1,10 @@
```text
Generates a static configuration JSON file based on the current window manager state
Usage: generate-static-config
Options:
-h, --help
Print help
```
+29
View File
@@ -0,0 +1,29 @@
```text
Add a dynamic layout rule for the specified workspace
Usage: named-workspace-layout-rule <WORKSPACE> <AT_CONTAINER_COUNT> <LAYOUT>
Arguments:
<WORKSPACE>
Target workspace name
<AT_CONTAINER_COUNT>
The number of window containers on-screen required to trigger this layout rule
<LAYOUT>
Possible values:
- bsp: BSP Layout
- columns: Columns Layout
- rows: Rows Layout
- vertical-stack: Vertical Stack Layout
- horizontal-stack: Horizontal Stack Layout
- ultrawide-vertical-stack: Ultrawide Vertical Stack Layout
- grid: Grid Layout
- right-main-vertical-stack: Right Main Vertical Stack Layout
- scrolling: Scrolling Layout
Options:
-h, --help
Print help (see a summary with '-h')
```
+4 -1
View File
@@ -1,13 +1,16 @@
```text
Start komorebi as a background process
Usage: start [-- <KOMOREBI_ARGS>...]
Usage: start [OPTIONS] [-- <KOMOREBI_ARGS>...]
Arguments:
[KOMOREBI_ARGS]...
Arguments to pass to komorebi, after a `--`: `komorebic start -- --log-level debug`
Options:
-c, --config <CONFIG>
Path to a static configuration JSON file
-h, --help
Print help
+32
View File
@@ -0,0 +1,32 @@
```text
Add a dynamic layout rule for the specified workspace
Usage: workspace-layout-rule <MONITOR> <WORKSPACE> <AT_CONTAINER_COUNT> <LAYOUT>
Arguments:
<MONITOR>
Monitor index (zero-indexed)
<WORKSPACE>
Workspace index on the specified monitor (zero-indexed)
<AT_CONTAINER_COUNT>
The number of window containers on-screen required to trigger this layout rule
<LAYOUT>
Possible values:
- bsp: BSP Layout
- columns: Columns Layout
- rows: Rows Layout
- vertical-stack: Vertical Stack Layout
- horizontal-stack: Horizontal Stack Layout
- ultrawide-vertical-stack: Ultrawide Vertical Stack Layout
- grid: Grid Layout
- right-main-vertical-stack: Right Main Vertical Stack Layout
- scrolling: Scrolling Layout
Options:
-h, --help
Print help (see a summary with '-h')
```