feat(wm): ignore, manage and float rules

komorebi managed every normal window that is alive, and there was no way to keep
an application out of the layout. The rule engine decides whether a window is
managed: an ignore rule keeps the windows it matches out, unless a manage rule
matches them too, and a float rule puts a window in the floating windows of its
workspace when it opens. A rule matches a window by its title, its executable,
its class or the path of its executable. Plasma's shell and KRunner are ignored
from the start.

`komorebic ignore-rule` and `manage-rule` add a rule, `session-float-rule`
floats the focused window and the windows like it until the daemon stops,
`clear-session-float-rules` removes those rules, and `global-state` shows the
rules. The `DebugWindow` message says why a window is managed or not.

Applications often open a window before they give it its title, so the bridge
now reports a title change, and a window komorebi does not have is asked about
again when its title changes, for a rule on the title to decide.

The vm-commands sweep adds and shows rules, and a section of its own checks that
a window an ignore rule matches by its first title is tiled once it has another.
vm-kwin-events checks that a window giving itself another title reaches the
daemon as a title update.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent c95be9391e
commit 1b10611022
32 files changed
+1755 -57

No files matched your search

+5 -4
View File
@@ -1,7 +1,8 @@
# Managing windows
komorebi tiles every normal application window that KWin reports, and leaves dialogs, splash
screens and other windows that are not for tiling alone. The commands here act on the window
screens and other windows that are not for tiling alone, and the windows that [rules](rules.md)
say to ignore. The commands here act on the window
that has the focus in KWin, take a window out of the layout or back into it, and pause the
daemon.
@@ -34,7 +35,7 @@ komorebic manage
```
`komorebic manage` also takes in a window komorebi missed, such as one that opened while the
daemon was paused. The daemon forgets an unmanaged window when it closes, and when the daemon
daemon was paused, but not a window an ignore rule covers. The daemon forgets an unmanaged window when it closes, and when the daemon
stops.
## Commands while the focused window is not tiled
@@ -58,8 +59,8 @@ sets the behavior back to `op`: give the focus to a tiled window first.
[`komorebic toggle-pause`](../cli/toggle-pause.md) pauses the daemon, and the same command
resumes it. While it is paused, komorebi does not act on what KWin reports, so it moves no
window, and of its commands it carries out only `toggle-pause`, `state` and `stop`. The daemon's
state says whether it is paused, as `is_paused`.
window, and of its commands it carries out only `toggle-pause`, `state`, `global-state` and
`stop`. The daemon's state says whether it is paused, as `is_paused`.
```sh
komorebic toggle-pause
+71
View File
@@ -0,0 +1,71 @@
# Rules
A rule names an application by one of four things about its windows, and says what komorebi does
with them:
- `exe`: the name of the program's executable, such as `kate`;
- `class`: the app id of a Wayland window, such as `org.kde.kate`, or the class of an X11 window;
- `title`: the title of the window;
- `path`: the full path of the executable, such as `/usr/bin/kate`.
[`komorebic state`](../cli/state.md) shows them for every window komorebi has, as the `title`,
`exe`, `class` and `path` of its `details`.
## Ignoring an application
[`komorebic ignore-rule`](../cli/ignore-rule.md) makes komorebi leave the windows of an
application alone. A rule given this way matches a title or a class that starts or ends with what
it names, and an executable or a path that is exactly what it names. The windows it matches are
not tiled when they open, and the tiled windows of the workspaces in front whose executable,
class, title or path is exactly what it names leave the layout.
```sh
komorebic ignore-rule exe steam
komorebic ignore-rule class org.kde.kcalc
komorebic ignore-rule title "Picture-in-Picture"
```
`komorebic float-rule` is the same command. Plasma's desktop and panels (`plasmashell`) and
KRunner are ignored from the start.
[`komorebic manage-rule`](../cli/manage-rule.md) makes komorebi tile the windows of an
application that an ignore rule covers, from the next one that opens.
```sh
komorebic manage-rule class org.kde.plasmashell
```
[`komorebic manage`](managing-windows.md#taking-a-window-out-of-the-layout) does not take in a
window an ignore rule covers: a manage rule does.
## When a rule decides
A rule decides when a window opens. Applications often open a window before they give it its
title, so the title a rule sees then can be a placeholder. When the title of a window komorebi
does not have changes, komorebi asks the rules again, so a window that a title rule ignored while
it had its first title is tiled once its title no longer matches. A window komorebi tiles stays
tiled whatever its title becomes.
## Floating the windows of an application
[`komorebic session-float-rule`](../cli/session-float-rule.md) takes the focused window out of
the layout into the floating windows of its workspace, and adds a rule that floats every window
that opens with the same executable, class and title.
[`komorebic session-float-rules`](../cli/session-float-rules.md) shows those rules, and
[`komorebic clear-session-float-rules`](../cli/clear-session-float-rules.md) removes them: the
windows that float already stay floating.
```sh
komorebic session-float-rule
komorebic session-float-rules
komorebic clear-session-float-rules
```
A window that a float rule matches floats when it opens, and
[`komorebic toggle-float`](floating-windows.md) puts one in the layout.
## How long rules last
The rules given with these commands last until the daemon stops.
[`komorebic global-state`](../cli/global-state.md) shows the ignore and the manage rules the daemon
has, and its data directory.