mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 05:41:16 +01:00
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:
1 parent
f530318cee
commit
40eec2f6be
18 files changed
+825
-62
No files matched your search
@@ -611,3 +611,16 @@ and tiles the monitors that changed. It keeps the
|
||||
monitor that went, with its workspaces and settings, so that an output that is plugged in again
|
||||
gets them back: the windows the monitor had are tiled elsewhere by then, and it comes back
|
||||
without them.
|
||||
|
||||
## Why does komorebi look at every window again a moment after the monitors change?
|
||||
|
||||
Because KWin moves windows about for a moment after the outputs change, so what it reports
|
||||
first is not where the windows end up. An output that went takes its windows to another, one
|
||||
that is plugged back may take them again, and a change of scale or resolution changes where the
|
||||
middle of a window is. The monitor reconciliator therefore waits 1.5 seconds after a change of
|
||||
the monitors (a burst of changes makes one wait) and then finds every container whose window is
|
||||
on another monitor than the one komorebi has it on, and follows it there. A window that KWin
|
||||
reports on another output is handled the same way, looking at every window and not only that
|
||||
one, since when one has moved others may have too. komorebi tiles at once the windows it knows
|
||||
about when the monitors change, such as those of an output that went; the ones KWin moves
|
||||
afterwards are tiled up to 1.5 seconds later.
|
||||
Reference in new issue
Block a user