mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-12-04 05:56:31 +01:00
feat(wm): a window the user maximizes
KWin maximizes a window for the user as well as for komorebi: the title bar, a double click and a shortcut do it, and nobody asks the window manager. A window that stayed a tile would be asked to move at the next retile, so komorebi has to know. The bridge reports KWin's maximizedChanged as a maximized event, true only when the window is maximized both ways. The table turns it into a MaximizeChange, and adopt_maximize_change takes the window out of the layout as toggle-maximize does, or, when the user restores it, puts it back in a container of its own at the index it came from. A window that is already maximized when komorebi starts, or that opens maximized, is the workspace's maximized window from the start. komorebi's own maximize is reported too and finds the workspace as it left it, so it changes nothing. While a window is maximized, what is asked of the layout does nothing, by the same rule as for toggle-maximize. A maximized window of a monitor that is unplugged goes to the monitor that is left and stays maximized: evacuate_monitor makes it the maximized window of the workspace it goes to, and the maximized window that workspace had goes back to its tile. Until now it came back as a tile. vm-user-maximize maximizes windows with kdotool in a headless KWin, and checks the daemon's state, the frames, that the layout commands do nothing, and that toggle-maximize and the user's restore both put the window back in its tile.
This commit is contained in:
1 parent
0210ec285a
commit
d6ad3b4292
31 files changed
+1246
-88
No files matched your search
+13
-6
@@ -123,12 +123,12 @@ It connects to the session bus as `org.komorebi.Bridge`, writes the bridge to
|
||||
`$XDG_RUNTIME_DIR/komorebi/bridge.js`, and asks KWin to load it under the name
|
||||
`komorebi-bridge`, replacing a script of that name left by an earlier run. The script reports
|
||||
the windows and outputs it finds, and from then on every window that opens, closes, takes the
|
||||
focus, is minimized or brought back, moves or changes size, the start and the end of every drag
|
||||
of a window by the user, and every change of the outputs (one that changes resolution or scale,
|
||||
and the room a panel leaves). KWin has no signal for that room, so the script looks at the
|
||||
outputs again when a dock window opens, closes or moves, and once a second; it also compares
|
||||
KWin's active window with the one it last reported once a second. The daemon waits up to 10
|
||||
seconds for the first report and does not start without it.
|
||||
focus, is minimized or brought back, is maximized or restored, moves or changes size, the start
|
||||
and the end of every drag of a window by the user, and every change of the outputs (one that
|
||||
changes resolution or scale, and the room a panel leaves). KWin has no signal for that room, so
|
||||
the script looks at the outputs again when a dock window opens, closes or moves, and once a
|
||||
second; it also compares KWin's active window with the one it last reported once a second. The
|
||||
daemon waits up to 10 seconds for the first report and does not start without it.
|
||||
|
||||
It also watches for the machine waking up and the screen being unlocked, with two signals that
|
||||
are not KWin's ([D-Bus](#d-bus)): logind's `PrepareForSleep` on the system bus, and the lock
|
||||
@@ -167,6 +167,13 @@ checks that the window fills the work area and is on top. The script API cannot
|
||||
so when the pointer follows the focus komorebi invokes KWin's own "Move Mouse to Focus" shortcut,
|
||||
which puts the pointer in the middle of the window KWin has focused.
|
||||
|
||||
Some of what the bridge reports is the user's doing, not the answer to a command. KWin raises
|
||||
`maximizedChanged` for komorebi's maximize and for the user's (the title bar, a double click, a
|
||||
shortcut) alike, and the bridge reports a window as maximized only when it is maximized both
|
||||
ways (`maximizeMode` 3): a window maximized in one direction is a restored window to komorebi.
|
||||
The VM test `vm-user-maximize` maximizes windows with `kdotool windowstate`, in both directions,
|
||||
and passes against KWin 6.8.1 at time of writing (2026-10-27).
|
||||
|
||||
#### When KWin restarts
|
||||
|
||||
KWin can go away while the session goes on: it crashed, or `kwin_wayland --replace` took its
|
||||
|
||||
Reference in new issue
Block a user