Expand description
Scrolling, as niri does it: columns, and a view anchored to one of them.
fit is adapted from niri’s compute_new_view_offset
(src/layout/scrolling.rs, niri-wm/niri@97c96a1, GPL-3.0-or-later,
© the niri contributors), which this project’s GPL-3.0-only can use. The
rest is behaviour modelled on niri’s scrolling layout: the behaviour is the
specification, and niri’s code is written against its own tile and
animation types.
Two ideas carry the whole design, and a strip of evenly-spaced windows has neither of them.
The unit is a column, not a window. A column holds a stack of windows sharing its width, and its width is a share of the view, never of the strip. Opening a tenth window cannot make the first nine thinner, because nothing in here divides anything by how many windows exist. That is the property that makes a scroller work the same on a laptop and a 49-inch display.
The view offset is measured from the active column, not from the left end of the strip. Moving focus rebases it by the distance between the old column and the new one, so the view and the focus can never disagree about where they are — which is what going wrong feels like when a scroller feels “fake”. An absolute scroll position would drift away from focus the moment a column ahead of it changed width.
Structs§
Constants§
- PRESETS
- The widths a column cycles through when the caller names none, as shares of the view.
Functions§
- fit 🔒
- Where the view should sit so a column is visible, moving as little as possible.