Expand description
Row/header/type-ramp sizing every Hyprforge app shares, derived from font metrics rather than copied out of a mockup as pixel constants.
Files’ design came first and moved here when Settings adopted the
same one, so the two draw a row, a bar and a corner the same size.
What only Files needs — the grid, its menus, its sidebar — stayed in
hyprforge-files-core.
The design specifies a 40px header, 28px rows, a 15px type ramp and a
6px-inner/12px-outer radius pair — but those numbers are only true at
the theme’s default text size and 100% FontScale. Pillar 7 puts
font scaling in the shared layer for exactly this reason: a 28.0
literal for row height clips its own text the moment someone raises
the scale past 1.0, because the text grows and the row does not. So
every design pixel value here is stored as its ratio to
BASE_TEXT_SIZE at identity scale.
Two different things come out of that ratio, deliberately kept apart:
- A text size (
ROW_TEXT_BASE,META_TEXT_BASE) is left unscaled and handed tocrate::widgets::scaled_text(ormeta_text) the same wayBASE_TEXT_SIZEitself already is everywhere else in this crate — applyingFontScalea second time here would compound it rather than replace it, the exact mistakeFontScale::apply’s own doc warns against. - A layout dimension (
row_height,bar_height) is a function that returns the final, already-scaled pixel value, because a container’sLength::Fixedneeds a concrete number, not something a widget will scale for it later.
At 100% the numbers below reproduce the design’s own values exactly (pinned in the tests); above 100% the row, the header and the text inside them grow together instead of the text alone overflowing a row that stayed put.
Radii take the same “ratio, not constant” shape but from
hyprforge_look::Theme::rounding instead of text size: the design’s
outer/inner pair is preserved as a relationship (inner is exactly
half the outer) rather than as two independent magic numbers, so a
user who changes Hyprland’s own decoration:rounding gets an inner
radius that stays visibly tighter than the outer one instead of one
that quietly drifts to match or overtake it.
Constants§
- META_
TEXT_ BASE - The metadata text size inside a row — size, modified, kind — also
unscaled. The design only names the 15px primary size; this keeps the
13/15 relationship the crate’s earlier hand-picked
13.0-vs-14.0pairing already had, expressed as a ratio of the primary size instead of a second independent constant. - ROW_
TEXT_ BASE - The primary text size inside a row — a file’s name — unscaled:
feed this straight to
scaled_text/meta_textas thebase_sizeargument, which appliesFontScaleitself, the same way every other call site feeds itBASE_TEXT_SIZE. It is already in the same “logical px before scale” unitBASE_TEXT_SIZEis, so no further division by it is needed — this constant is the design’s 15px type ramp at identity scale, not a ratio applied to something else. - SECTION_
LABEL_ BASE - A sidebar section heading —
PLACES,PINNED,TRASH.
Functions§
- bar_
height - The header bar’s height. 44px at 100% scale.
- card_
radius - A card’s corner — a setting row, a hero card, a table row. The mockup’s 9px, and its most common radius by far.
- field_
height - A text field — the path bar, the search field. 28px at 100%.
- glyph_
button - A glyph button — the nav cluster, a view-mode segment. 26px at 100%.
- inner_
radius - A row’s/sidebar button’s corner radius — the design’s “6px inner”.
See the module doc: this is deliberately half of
outer_radiusrather than its own constant. - nested_
radius - The radius on something nested inside a control — the path bar’s current-directory chip, a segment inside the view-mode track.
- outer_
radius - The window’s own corner radius — the design’s “12px outer”. Taken
straight from the active
hyprforge_look::Themerather than duplicated:Theme::roundingalready is Hyprland’s owndecoration:rounding, and it happens to default to 12, which is a measured fact about the default theme rather than a coincidence this function relies on. - row_
height - A list row’s final height in logical pixels,
FontScalealready applied.28.0atFontScale::default; grows proportionally above 100%. - setting_
row_ height - A setting row’s least height — the design’s 52px card row at 100%.