feat(wm): outputs unplugged and plugged back

KWin takes the windows of an output that goes to the outputs that are left and
puts them where it likes, so komorebi's tiles for them were on a screen that was
gone and the windows sat untiled where they landed. The monitor reconciliator
now deals with a change in the set of monitors: the table announces it as a
display connection change instead of a resize, and reconcile_display_change
reads the monitors again, keeps each one that went (workspaces, layouts,
paddings, offsets) in a cache, has the window manager move what was on it to the
monitors that are left, and removes it.

The move is WindowManager::evacuate_monitor, in the new reconcile module: each
container and floating window goes to the workspace of the same number on the
monitor that holds the middle of its window, or on the first monitor that is
left when it is on none, and the workspaces that changed are tiled. A stack goes
as one container, and a monocle and a maximized window come as ordinary
containers. A monitor that is plugged in takes what was cached under its serial
number id, less the windows that closed or that the window manager has elsewhere
by now, so it comes back with its settings and none of the windows it had. A
monitor komorebi never saw gets workspaces of its own, and when the compositor
reports no output at all nothing is done.

The workspace rules of a monitor that goes are dropped, and those of the
workspaces of one that comes back apply again. komorebi.json fills the cache as
well: a monitor that has the entry its display index preference names is kept
with it, and so is the entry of each preference whose monitor is not connected,
which that monitor takes when it is plugged in.

vm-hotplug now sends two windows to the other monitor with komorebic, disables
that output, enables it again and sends a window over once more.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:57 -07:00
1 parent c8dc92a236
commit f530318cee
15 files changed
+1291 -79

No files matched your search

+10 -5
View File
@@ -82,10 +82,11 @@ without a checkout of the toolchain.
some elements are locked in place. It answers the messages on the daemon's
socket (`core::SocketMessage`, `process_command`), shows its state (`state`),
keeps the monitors in step with the compositor's outputs as they change size
(`monitor_reconciliator`), sends its subscribers a notification of each
event, message and change of the monitors it handles (`notify_subscribers`),
and is configured by a `komorebi.json` that it reads and reads again when it
changes (`static_config`).
and are unplugged and plugged in (`monitor_reconciliator`, `reconcile`),
sends its subscribers a notification of each event, message and change of
the monitors it handles (`notify_subscribers`), and is configured by a
`komorebi.json` that it reads and reads again when it changes
(`static_config`).
- [`komorebi-client`](komorebi-client): a library that sends messages to the
daemon, reads its answers, subscribes to its notifications, and re-exports
the types they are made of.
@@ -168,7 +169,11 @@ another desktop, the window manager follows.
When a monitor changes size (a resolution, a scale, a panel that takes more room),
the bridge reports the outputs again and the monitor reconciliator, a thread of
the daemon, reads the size and the work area of every monitor and tiles the
workspace in front of the focused monitor in the area it now has.
workspace in front of the focused monitor in the area it now has. When an output
is unplugged, KWin takes its windows to the outputs that are left, and the
daemon takes the monitor's containers over to the monitors the windows are on,
tiles them there, and keeps the monitor, with its settings, for when it is
plugged in again.
The window manager models the desktop as monitors, each with a ring of
workspaces, each with a ring of containers, each with a ring of windows. A