Label the tiles

"title · app" centred under each thumbnail, in the same font the rofi
theme used (Berkeley Mono at pango's "small"), with the selected tile's
label inverted onto the yellow the way rofi's element background did.
Long titles are ellipsised to the cell width.

Text comes from cosmic-text, which brings real shaping. The catch is
cost: building a font system and rasterising the first glyphs takes
~55ms, nearly doubling a 65ms startup. But the capture phase is ~55ms of
sitting blocked while the compositor copies pixels, so labels are shaped
on a worker thread started before the captures and joined after them.
The measured labels phase is now 0.0ms — it costs nothing in wall clock.

Two thirds of that font cost was FontSystem::new() scanning all 1793
system faces, which even new_with_fonts() does. So the database is built
by hand: the user's own font directories first, since they are small,
and the full system scan only when the family isn't found there. An
unknown family still resolves, because that fallback is exactly the
system scan (verified: --font "No Such Font" renders in Noto).

--hide-labels restores the icon-only grid, and --font/--font-size make
the family and size settable. Adds a test that a label actually puts
pixels on the surface, one for ellipsising, and one pinning the label row
into the element geometry.
This commit is contained in:
Milad Alizadeh
2026-08-23 10:39:37 +01:00
parent dbfc06519a
commit 2cd076699d
7 changed files with 702 additions and 30 deletions
+1
View File
@@ -12,6 +12,7 @@ wayland-protocols-wlr = { version = "0.3", features = ["client"] }
memmap2 = "0.9"
rustix = { version = "1", features = ["fs", "mm", "shm"] }
swayipc = "4"
cosmic-text = "0.19"
[profile.release]
strip = true