feat(wm): follow a window moved to another output

A window can be moved to another output by something other than komorebi: a KWin
shortcut that sends it to the next screen, the window menu, an application.
komorebi had it in a container of the old monitor, whose tile is on a screen the
window is not on, so it sat untiled where it landed.

The bridge now reports a window's output changing, with the frame the window has
by then, since the signal and the frame arrive in no fixed order, and the table
makes it an OutputChange event. The window manager handles it with
WindowManager::follow_windows_to_their_monitors: every container whose focused
window, and every floating window, is on another monitor than the one it has it
on moves whole to the workspace of the same number on the monitor that holds the
middle of its frame, and the monitors that changed are tiled. Every window is
looked at, not only the one in the event, and a move komorebi made itself is in
its state already and finds nothing to do.

Nothing is followed while the user drags a window: the end of the drag decides
where that window goes, so the method returns at once while a move or a resize
by the user is going on.

KWin also moves windows for a moment after outputs come and go, so the monitor
reconciliator looks again 1.5 seconds after each notification, where it used to
trust what it found at once. vm-hotplug sends windows over with kdotool as well
as with komorebic.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:57 -07:00
1 parent f530318cee
commit 40eec2f6be
18 files changed
+825 -62

No files matched your search

+5
View File
@@ -442,6 +442,11 @@ with two outputs of 1920x1080:
how it gets it back. The script reports the outputs that are left after the first and all of
them after the second, and komorebi follows both. A disabled output is enabled again by the
name it had.
- A window that a script moves so that the middle of its frame is on the other output is on
that output: `Window.output` follows the middle of the frame (found in the spikes with two
outputs on KWin 6.8.1). Its desktops are not changed by the move, so it stays on the desktop
it was on. KWin raises `outputChanged` for it, which `vm-hotplug` shows by moving windows with
`kdotool windowmove`, as a shortcut or the window menu would.
## How long a retile takes