mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-17 06:11:21 +01:00
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:
1 parent
c8dc92a236
commit
f530318cee
15 files changed
+1291
-79
No files matched your search
@@ -18,12 +18,41 @@ KWin has no signal for the room a panel leaves, so komorebi looks at it when a p
|
||||
closes or moves, and once a second. A panel that is laid out a moment after komorebi starts is
|
||||
found within a second.
|
||||
|
||||
A monitor that is unplugged or plugged in is not followed: komorebi keeps the monitors it
|
||||
started with until it is started again.
|
||||
## A monitor is unplugged
|
||||
|
||||
KWin takes the windows of an output that goes (it is unplugged, or disabled with
|
||||
`kscreen-doctor output.<name>.disable`) to the outputs that are left, and puts them where it
|
||||
likes. komorebi takes the monitor's workspaces over there: every container, and every floating
|
||||
window, goes to the workspace with the same number on the monitor KWin put its window on, and
|
||||
the workspaces that changed are tiled again. A [stack](stacking-windows.md) goes as a stack. A
|
||||
monocle window and a maximized window come as tiles of their own, and the windows the monocle hid
|
||||
are shown again.
|
||||
|
||||
komorebi keeps the monitor that went, with its workspaces, layouts, paddings and offsets, for
|
||||
when it comes back, and forgets the [workspace rules](workspace-rules.md) of its workspaces until
|
||||
then. When no output is left at all, komorebi does nothing.
|
||||
|
||||
## A monitor is plugged in
|
||||
|
||||
komorebi knows a monitor by the manufacturer, the model and the serial number KWin reports for
|
||||
the output, or by the output's name when it has no serial number. A monitor komorebi has kept
|
||||
comes back with what was kept: its workspaces and their settings, and the wallpaper of the
|
||||
monitor, less the windows that have closed or that are somewhere else now. Its windows were tiled
|
||||
on other monitors when it went, so it comes back with none of them. The monitor that had the focus
|
||||
keeps it, and every monitor shows its workspace in front.
|
||||
|
||||
A monitor that komorebi has not seen gets workspaces of its own, and the windows that open on it
|
||||
are tiled there. When `komorebi.json` has an entry for the monitor in
|
||||
[`display_index_preferences`](configuration.md#monitors-and-workspaces) and the monitor was not
|
||||
connected when the file was read, it takes the entry when it is plugged in. The monitors are put
|
||||
at the index the user gave them with
|
||||
[`komorebic display-index-preference`](../cli/display-index-preference.md), and after the other
|
||||
monitors otherwise.
|
||||
|
||||
## Following it from a program
|
||||
|
||||
A [subscriber](subscribing-to-notifications.md) is sent a notification each time komorebi has
|
||||
read the monitors again, whether or not anything changed in the state. Its `event` is
|
||||
`{"Resize":0}`, where the number is the id of the monitor that changed, or 0 when KWin does not
|
||||
say which.
|
||||
dealt with a change of the monitors, whether or not anything changed in the state. Its `event` is
|
||||
`{"Resize":0}` for a change of size, where the number is the id of the monitor that changed, or 0
|
||||
when KWin does not say which, and `{"DisplayConnectionChange":0}` for a monitor that was
|
||||
unplugged or plugged in.
|
||||
@@ -38,9 +38,10 @@ A notification has two fields:
|
||||
with the signal it came from and the window, such as
|
||||
`{"type":"Show","content":[{"type":"KWin","content":"WindowAdded"},{"id":...}]}`. A
|
||||
message is written the way a client writes it on the daemon's socket, such as
|
||||
`{"type":"Retile"}`. A change of the monitors is the name of the change with its content,
|
||||
such as `{"Resize":0}`: the id of the monitor that changed, or 0 when KWin does not say
|
||||
which. [Changing monitors](changing-monitors.md) says when each is sent.
|
||||
`{"type":"Retile"}`. A change of the monitors is the name of the change with its content:
|
||||
`{"Resize":0}` for a monitor that changed size, with the id of the monitor, or 0 when KWin
|
||||
does not say which, and `{"DisplayConnectionChange":0}` for a monitor that was unplugged or
|
||||
plugged in. [Changing monitors](changing-monitors.md) says when each is sent.
|
||||
- `state`: the state of the window manager after it, with the same fields as what
|
||||
[`komorebic state`](../cli/state.md) prints, on one line.
|
||||
|
||||
|
||||
Reference in new issue
Block a user