Files
komorebi/docs/usage/stacking-windows.md
T
LGUG2Z 331db681e2 feat(wm): stack out of sight on a parking desktop
A container has one tile, so the windows of a stack that are not in front have
to be out of sight. KWin has nothing a script can set to hide a window except a
virtual desktop nobody looks at, which the first spike measured to cost no focus
change where minimizing a window cost two. Backend::hide takes a window out of
sight and Backend::restore brings it back; the KWin backend parks the window on
a desktop named komorebi-park, which the table keeps out of the workspaces, and
remembers where each hidden window came from so that it is still on its
workspace.

KWin saves a desktop in kwinrc as soon as it is made, so komorebi removes the
parking desktop when it stops, after the windows are back, and the first
snapshot of the next run finds one a killed run left, sends its windows home and
removes it. The windows komorebi hid are recorded, so that a minimize the
compositor reports for one is not mistaken for the user's.

komorebic stack, unstack, stack-all and unstack-all stack and unstack windows.
The window container behavior and the float override decide whether a window
that opens joins the focused container or floats, for every workspace or for
one. vm-stacks stacks windows in a headless KWin, shows a workspace and goes
back, stops, and kills the daemon with a window parked.
2026-10-28 07:20:37 -07:00

4.0 KiB

Stacking windows

A stack is a container with more than one window. The windows share one tile of the layout, and one of them, the window in front, is in sight: the others are out of the way. Stacking puts two windows on one tile, so the layout has one tile fewer to give out.

Putting windows in a stack

komorebic stack puts the focused window and the window on one side of it in one stack: left, right, up or down. As with komorebic focus, the layout decides which tile is on which side. The focused window ends up in front, and it keeps the focus. Where the layout has no tile on that side, nothing happens.

komorebic stack left
komorebic stack down

komorebic unstack takes the window in front out of its stack and puts it in a tile of its own after the stack, and the next window of the stack is in front again. A window that is alone on its tile cannot be unstacked, and the daemon logs "a container must have at least one window".

komorebic unstack

komorebic stack-all puts every window of the focused workspace in one stack, in the order they had, with the focused window in front. komorebic unstack-all takes every window out of the focused stack, each onto a tile of its own, and the window that had the focus keeps it.

komorebic stack-all
komorebic unstack-all

A stack moves as one: moving it with komorebic move or to another workspace takes every window in it. When the window in front closes, the next window of the stack comes to the front and has the focus.

Windows that open into a stack

By default a window that opens gets a tile of its own. With the window container behavior set to append, a window that opens joins the focused stack instead, in front, and a workspace with no window still gives it a tile of its own, since there is nothing to join. komorebic toggle-window-container-behaviour switches every workspace between the two. komorebic toggle-workspace-window-container-behaviour does it for the focused workspace only: the first time, it takes the opposite of what every workspace has, and from then on it follows its own setting.

komorebic toggle-window-container-behaviour
komorebic toggle-workspace-window-container-behaviour

The setting is in the daemon's state, as new_window_behaviour for every workspace and as window_container_behaviour in each workspace that has one of its own.

Where the windows behind go

komorebi does not minimize the windows behind the front one: it moves them to a virtual desktop that nobody looks at, which it makes when it first needs it and calls komorebi-park. A window there is still open, still on its workspace as far as komorebi is concerned, and still in the stack, and it comes back to the desktop of its workspace when it is brought to the front, when it is unstacked, and when komorebi stops. The parking desktop is the last desktop, after the ones that are workspaces, and is not one of them.

KWin keeps its virtual desktops in its configuration as soon as one is made, so the parking desktop would be there in the next session if komorebi did not remove it. It does when it stops. If komorebi did not get to stop (it was killed, or the session ended under it), the next komorebi finds the parking desktop in KWin's list, sends the windows on it back to the first workspace's desktop, and removes it. If the parking desktop is removed while komorebi runs, the next hide makes a new one.

A window on the parking desktop can still be reached by something else. Raising one, with a click in the task manager, makes KWin show the parking desktop on that monitor, and komorebi sends the monitor straight back to the workspace it was showing. The window that was raised becomes the front of its stack when komorebi handles its focus change.