Commit Graph
3 Commits
Author SHA1 Message Date
LGUG2Z 21017b573f feat(wm): initial window placement rules
A window that opens goes after the focused container. A workspace can now say
another place for its windows: the primary or the secondary tile, before or
after the focused container, the end of the list, or a place by number, counting
from 1. The place is for every window, or for the windows that match a rule on
their program, app id, title or path; the rules are the conditions the ignore
and manage rules are made of, and the first that matches in key order decides. A
place that does not exist, such as the secondary tile of a workspace with one
container, is the default place.

A place is read from a name, a number or text that is a number. The
documentation of the setting shows a number and a map's keys can only be text,
and komorebi for Windows (83c4e11d) reads only text, so the form its own page
shows is refused there.

A place that was reserved with preselect-direction is used before the rules are
asked, and a locked container keeps its index. A workspace whose
window_container_behaviour is Append puts a window in the focused container, and
the rules are not used.

A workspace takes the rules from the key initial_window_placement_rules of its
entry in komorebi.json. The key is in schema.json and so in the typed config
option of the module, and the page docs/initial-window-placement-rules.md says
how to write it. vm-placement opens windows in a headless KWin and checks where
they go, by program, app id and title.

The schema that schemars derives for a place is an object with a Placement or an
Index key, which is not what is read or written, so a check against it refuses a
file that the daemon reads. The schema of PlacementTarget is written by hand
instead: a name, a number, or text that is a number. A file with a place of each
form is checked against schema.json, and the module's config option takes them.
2026-10-28 07:20:57 -07:00
LGUG2Z 1b10611022 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.
2026-10-28 07:20:37 -07:00
LGUG2Z 56294e1cd3 feat(wm): manage, minimize and close
Every normal window KWin reports is tiled, and the only way to take one out of
the layout was to float it, which keeps it a window komorebi manages. `komorebic
unmanage` takes the focused window out of the layout, and komorebi leaves it
alone until `komorebic manage` takes it back or the window closes. Both are
events komorebi raises itself on the channel KWin's events go through, so they
are handled in order with what KWin reports. `komorebic minimize` and `close`
ask KWin to minimize or close the focused window, which leaves the layout when
KWin reports that it did.

`komorebic toggle-pause` pauses the daemon: it acts on no event, and takes only
`toggle-pause`, `state` and `stop` on its socket until it is resumed. With
`unmanaged-window-operation-behaviour no-op`, the daemon refuses every message
while the focused window is not one it tiles.

The vm-commands sweep pauses and resumes, sets the operation behavior, manages
and closes the focused window, and a section of its own minimizes, unmanages and
manages a window.
2026-10-28 07:20:37 -07:00