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.
2.2 KiB
Maximizing windows
komorebic toggle-maximize has KWin maximize the window that has the
focus: it takes the work area of its monitor, the panels left alone, and has no padding around it.
The window leaves the layout while it is maximized, and the same command restores it and puts it
back in a container of its own, at the place in the order of the workspace it was taken from.
komorebic toggle-maximize
A window that is the only one of its container takes the container with it, and the container is made again when the window comes back. The tiles that were left are not moved while the window is maximized: it covers them. A window that opens meanwhile is added to the layout, after the focused container, and has its tile when the maximized window is restored. A window that closes while it is maximized takes the maximize with it, and the other windows are tiled again.
A window in monocle that is maximized leaves the monocle.
What is left alone
While a window is maximized, the commands that are about the tiles of the layout do nothing, and
the daemon logs that it ignores them: move, cycle-move,
the stack commands, promote and the other promote
commands, resize-edge and resize-axis,
preselect-direction, toggle-lock,
toggle-float, toggle-monocle, and the
commands that move or send a container to another monitor or workspace, such as
move-to-monitor and
send-to-workspace. Restore the window first.
komorebic focus finds no container on any side of the maximized window, so
the focus goes to the monitor on that side, and the command fails where there is none. A
maximized window, or a window in monocle, on the workspace it reaches is given the focus whole.
In the daemon's state
A workspace with a maximized window has it as maximized_window, which is not in its
containers, and the index it goes back to as maximized_window_restore_idx.