feat(wm): tune layouts, and the scrolling layout

`komorebic layout-ratios --columns ... --rows ...` sets the share of the work
area the first columns and rows of the focused workspace's layout take, and
`scrolling-layout-columns N` how many columns of the scrolling layout are in
view. Both are layout options of the workspace, which komorebi-layouts reads.

The scrolling layout is a strip of columns that runs past the edges of the work
area, so its tiles are not clamped to it: the windows of the columns out of view
are off the screen. When a window of a scrolling workspace gets the focus, the
workspace is tiled after the focused container changed, which scrolls the strip
to it.

KWin moves a window anywhere, but keeps 100 pixels of a window it resizes on an
output once the client has drawn at the new size, which pulls the columns out of
view back onto the screen. The bridge remembers the position it was asked for,
for a second, and asks again for the position alone when KWin moved the window
elsewhere, three times at most.

komorebi-layouts compiles `Rect::percentage_within_horizontal_bounds` only with
its darwin feature, which this repository does not enable, so the workspace has
its own copy of it.

A new VM suite, vm-scrolling, after the spike's m2-scrolling script, checks in a
real KWin that the columns out of view stay where komorebi put them and that the
strip follows `komorebic focus`; vm-commands sweeps the two new commands.
This commit is contained in:
LGUG2Z committed 2026-10-28 07:20:37 -07:00
1 parent 41c32aad8e
commit 37b06993d2
23 files changed
+908 -39

No files matched your search

+36
View File
@@ -39,6 +39,42 @@ right main vertical stack.
[`komorebic query focused-workspace-layout`](../cli/query.md) prints the layout of the focused
workspace.
## Ratios
[`komorebic layout-ratios`](../cli/layout-ratios.md) sets the share of the work area the first
columns (`--columns`) and the first rows (`--rows`) of the focused workspace's layout take, as
fractions: `--columns 0.6` gives the first column 60% of the width, and the columns after it
share the rest.
```sh
komorebic layout-ratios --columns 0.6
komorebic layout-ratios --columns 0.5 0.3 --rows 0.7
```
Each takes five ratios at most, each kept between 0.1 and 0.9, and the ratios after the one that
would make them add up to 1 are dropped, so that there is always room for another column or row.
The ratios stay with the workspace when its layout changes. Without `--columns` or `--rows`,
`layout-ratios` changes nothing.
## The scrolling layout
The scrolling layout puts every container in a column of its own, the columns side by side in a
strip that runs past the edges of the monitor. The windows of the columns out of view are off
the screen, and KWin leaves them there. When a window of the workspace gets the focus, the strip
scrolls so that its column is in view, so `komorebic focus left` and `focus right` walk along
it.
[`komorebic scrolling-layout-columns`](../cli/scrolling-layout-columns.md) sets how many columns
are in view at once on the focused workspace:
```sh
komorebic change-layout scrolling
komorebic scrolling-layout-columns 2
```
Off the screen to the right of one monitor is on the next monitor over, if there is one, so the
columns out of view can show on it.
## Flipping the layout
[`komorebic flip-layout`](../cli/flip-layout.md) mirrors the tiles of the focused workspace: