mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-19 23:28:34 +01:00
feat(wm): maximize
A window could be given the work area only as a tile of the layout, which has padding around it. `komorebic toggle-maximize` has KWin maximize the focused window instead: it gets the work area of its monitor with the panels left alone, and it leaves the layout, so that it is in no container. Toggled again, the window is restored, put in a container of its own at the index it was taken from, and the workspace is tiled again. The window is kept in the workspace as its maximized window, with the index it goes back to, and the state shows both. While it is maximized the workspace asks KWin to maximize it again on every tiling, and does not move the containers behind it. The messages that are about the tiles (move, stack, resize, promote, preselect, lock, float, monocle, and the ones that send a container to another monitor or workspace) are dropped before they are handled, since there is no tile to act on. Focusing in a direction finds no container on any side of it, so the focus goes to the monitor on that side, where a maximized window or a monocle is given the focus whole. Showing the workspace again restores the maximized window and focuses it ahead of the containers' windows. A window in monocle that is maximized leaves the monocle, and one that closes takes the maximize with it. Backend gets a maximize command, which does nothing unless a backend implements it; the fake desktop and the KWin backend do, and the bridge carries it out with KWin's own `setMaximize`. A maximize also makes the bridge forget the position it was last asked to put the window at, which it would otherwise set again on the work area's size when the window's frame changed within a second of a tiling. komorebi/tests/maximize.rs and maximize_commands.rs drive it against the fake desktop, with one monitor and with two. The bridge's tests and the backend's tests read the maximize command from the same fixture, so that what one sends is what the other carries out. vm-features is a new session suite that reads screenshots: the first thing it checks is that the maximized window fills the work area, is the one on top, and goes back to its tile; the vm-commands sweep runs the new command.
This commit is contained in:
1 parent
0d21dd332c
commit
05de20749b
31 files changed
+1501
-68
No files matched your search
@@ -315,3 +315,16 @@ the same reason `update` does not shorten the list of adjustments while there is
|
||||
container: with two containers, one of them in monocle, the list would be cut to one, and the
|
||||
adjustment of the container in monocle would be lost when it came back (the comments in
|
||||
`new_monocle_container` and `update`).
|
||||
|
||||
## Why does a maximized window leave the layout, instead of being given the work area?
|
||||
|
||||
Because KWin has a maximize of its own, and komorebi asks for it. The window gets the work area of
|
||||
its output with the panels left alone, and a restore goes back to where the window was
|
||||
(`docs/kde.md`, and the comment in the bridge where it carries the command out). It is the work
|
||||
area and not the padded one that [`Workspace::update`](../../komorebi/src/workspace.rs) maximizes
|
||||
a window to ("the compositor's own maximize, which is the work area and not the padded one"), so
|
||||
the window cannot be a container: a layout would give it a tile, less the padding. It is held in
|
||||
`maximized_window` instead, with the index it came from, and when it is restored it goes back to
|
||||
that index in a container of its own. It is restored before it is tiled again, because "it is its
|
||||
tile's size that it has to get back, not the compositor's idea of its old size" (the comment in
|
||||
`reintegrate_maximized_window`).
|
||||
Reference in new issue
Block a user