Size the grid by caps, not by tile size

tile-width and tile-height are gone. In their place the config states a
box and a grid, all four settings caps of the same kind:

    max-width   = 90ppt      # the box the grid may fill
    max-height  = 90ppt
    max-columns = 4          # the grid inside it
    max-rows    = 4

A thumbnail is that box divided by those caps. The property that buys is
that a thumbnail's size no longer depends on how many windows are open:
one window gets the same thumbnail as thirty, in a smaller overlay,
because the overlay hugs whatever is actually there. Rows past max-rows
still scroll.

It also removes two things that were hard to explain. tile-height used to
default to the display's aspect through a rule you could only learn from
the documentation — the shape now falls out of the box and the grid.
And ppt meant "of the display width" on one key and "of the display
height" on another; the two remaining lengths take the axis their name
implies.

The 90% fill constant went with them: it was an invisible cap doing the
job max-width now does out loud, and its old value is the default.

Turning labels off now gives that row to the thumbnails rather than
shrinking the window, which follows from the box being what you asked
for. Verified on a 1280x1440 display: 90ppt gives a 1149x1293 overlay,
60ppt gives 765x861, and caps of 2x2 in the same box give larger
thumbnails that scroll after two rows.
This commit is contained in:
Milad Alizadeh
2026-09-06 10:46:15 +01:00
parent 13c0252cef
commit 86319aa309
5 changed files with 173 additions and 178 deletions
+21 -24
View File
@@ -150,10 +150,10 @@ selection-text = #282828 # its label
border = #d79921
border-width = 2px
tile-width = 18ppt # largest a thumbnail may be
tile-height = 20ppt # defaults to the display's aspect
max-columns = 4
max-rows = 3 # default: however many the display fits
max-width = 90ppt # the box the grid may fill
max-height = 90ppt
max-columns = 4 # thumbnails are that box divided by these
max-rows = 4
font = monospace
font-size = 13.3
@@ -164,30 +164,27 @@ fps = 12
format = tsv
```
Sizes take sway's units: `600px` is absolute, `70ppt` a percentage — and the
Sizes take sway's units: `600px` is absolute, `90ppt` a percentage — and the
percentage resolves against **the display the grid actually appears on**, every
time it runs. On a mixed setup one file gives 18% of a 1280-wide laptop panel and
18% of a 3840-wide monitor, instead of a pixel count that suits one and looks
wrong on the other. The overlay is mapped explicitly on that display, at that
display's scale, so mixed-DPI renders crisply either way.
time it runs. On a mixed setup one file gives 90% of a 1280-wide laptop panel and
90% of a 3840-wide monitor, rather than a pixel count that suits one and looks
wrong on the other. The overlay maps explicitly on that display, at its scale, so
mixed-DPI renders crisply either way.
`tile-width` and `tile-height` set how big a thumbnail actually is. Give only
the width and the height follows the display's aspect, which is roughly the shape
of the windows on it — a 16:9 cell wastes about half its area on a portrait
monitor.
All four sizing settings are **caps**:
Nothing sets the overlay's height directly: it is as many rows as fit in 90% of
the display, so below that threshold the window hugs the grid. `max-rows` caps it
if you would rather have a compact strip that scrolls sooner than a full-height
overlay — the symmetric partner to `max-columns`.
- `max-width` and `max-height` bound the overlay.
- `max-columns` and `max-rows` bound the grid inside it.
When there are more rows than can be shown, **the grid scrolls**: the tile size
you asked for is honoured and a scrollbar appears in the right margin.
Any move keeps the selection in view, `PgUp`/`PgDn` jump a screen, and tiles
scrolled out of sight are unmapped — so live capture skips them too, which is
what stops a long list costing bandwidth for pixels nobody sees. Only a tile too
large for even one row or column is shrunk, since then nothing could be shown at
all.
A thumbnail is simply that box divided by those caps, which means **its size
never depends on how many windows are open**: one window gets the same
thumbnail as thirty, in a smaller overlay, because the overlay hugs whatever is
actually there. Rows past `max-rows` scroll, with a scrollbar in the right
margin, `PgUp`/`PgDn`, and the selection always kept in view. Tiles scrolled out
of sight are unmapped, so live capture skips them too.
Turning labels off gives that row back to the thumbnails rather than shrinking
the window, since the box is what you asked for either way.
## Look