fix(menu): #131 — size text menus in ch with a cap, not in % of the monitor
All checks were successful
Check / eval (push) Successful in 3m49s

Bernardo saw Recovery ellipsize on a 2560x1440 external, which falsified
the item's model (40% + Inter 11 → "only below 1920"). Real cause: text
menus render through themes/<slug>/rofi.rasi, where boreal + neon-glass
pinned width: 620px (fixed — a wide panel buys nothing) while seven used
40%, and the font is whatever that file says — mostly monospace, far
wider than the Inter that was measured. The modelled combination ships in
no theme.

The insight: a menu must fit its longest label, which is a count of
characters in the THEME's font — so the window must scale with the font,
not the screen. 40% gives a 1366 panel 546px and a 2560 one 1024px for
the same row, and a 14pt mono theme needs ~25% more room than an 11pt one
on both; a percentage cannot see either fact.

Rofi has the right unit (`ch` = width of one digit in the current font)
and `calc( a min b )` to cap it, so every text menu — generated and all
nine whole-swaps — is now `width: calc( 84ch min 65% )`. 84ch fits the
longest row we ship (69 chars) plus icon and padding; the cap is
Bernardo's condition (never sprawl on a low-res panel) and it is
measured, not assumed.

Verified on hardware, not by arithmetic: 84ch = 756px in GeistMono 11 and
924px in JetBrainsMono 14; `calc( 84ch min 300px )` → 300px, so the clamp
really clamps. Screenshots at both ends — the real Recovery menu at 756px
(29% of 2560) with every label complete, and the Acer worst case
reproduced pixel-exactly (888px = 65% of 1366, JetBrainsMono 14) also
complete. Grid views override width per-invocation and are untouched.
checks.rofi-text-width guards the class, proven by pinning boreal back to
620px and watching it fail by name. Acer V3 queued for its own fontconfig.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-16 10:20:49 +01:00
parent 39c8b3e0eb
commit 5aad3153ce
15 changed files with 106 additions and 71 deletions

View File

@@ -449,6 +449,34 @@ Design/decision records and a running log of shipped work (items marked
(#131). Those windows therefore carry float/center rules and deliberately no
`size` rule. Measured after: calendar 1536×936 = exactly 60%×65%, doctor
1408×1008 = 55%×70%, both centred in the Waybar work area.
- ✓ **Menus are sized in `ch`, not in % of the monitor (#131, 2026-07-16):**
Bernardo saw Recovery's labels ellipsize **on a 2560×1440 external** — which
falsified the item's own model ("`width: 40%` + Inter 11 → only below ~1920;
confirm on the Acer"). Two wrong assumptions, and the diagnosis is the
interesting part: text menus render through `themes/<slug>/rofi.rasi`, where
**boreal and neon-glass pinned `width: 620px`** — fixed, so a wide panel buys
nothing — while the other seven used `40%`; and the font is whatever that file
says (boreal GeistMono 11, summer/kanagawa JetBrainsMono 14, …), mostly
**monospace**, far wider than the Inter that was measured. The modelled
combination was shipped by no theme at all.
The insight: **a menu must fit its longest label, which is a count of
characters — so the window has to scale with the font, not the screen.** 40%
of a 1366 panel and of a 2560 one give the same row 546px and 1024px, and a
14pt mono theme needs ~25% more room than an 11pt one on both; a percentage
cannot see either fact. Rofi has the right unit — `ch`, the width of one digit
in the theme's own font — and `calc( … min … )` to cap it. So every text menu
(generated + all nine whole-swaps) is now `width: calc( 84ch min 65% )`:
84ch fits the longest row we ship (69 chars) plus icon and padding, and the
cap answers Bernardo's condition — a big font on a small panel is clamped
rather than sprawling. Measured on hardware: 84ch = 756px in GeistMono 11 and
924px in JetBrainsMono 14, `calc( 84ch min 300px )` → 300px (the cap really
clamps). V3 by screenshot, both ends: the real Recovery menu at 756px (29% of
2560) with every label complete, and the Acer's worst case reproduced exactly
— 888px (=65% of 1366) with JetBrainsMono 14 — also complete. Grid views
(theme picker, drun) override width per-invocation and are untouched: they are
sized by icons, not text. `checks.rofi-text-width` guards the class — a
whole-swap that sizes its text menu without `ch` + a `min` cap fails, proven
by pinning boreal back to 620px and watching it name boreal.
- ✓ **Waybar whole-swap on-clicks lost their environment (#141, 2026-07-16):**
clicking the updates module did nothing. Not an updates bug — a **parity**
break: the generated module bakes the terminal in at eval time, but the four