status bar
git clone https://git.lucas.co/cce-status-interface.git
feat: module { font_size } app-config key
Fifth key in the bar's config file: module { font_size }, resolved ahead
of the size embedded in the shared font string ("Chivo Mono 14") and the
shared status_font_size.
The first attempt was dead on arrival, which exposed the real plumbing:
the toolkit's text pipeline lets a size inside the font-family string
OVERRIDE the explicit font-size parameter, so as long as rebuild_layout
passed the raw "Chivo Mono 14" string every label rendered at 14
regardless. rebuild_layout now strips the size from the family
(parse_font_string) and lets the explicitly resolved size through —
verified live: font_size 14→18 grew the clock 322→406px and back.
Co-Authored-By: Claude Fable 5 <[email protected]>
CLAUDE.md | 4 +++-
src/config.rs | 6 ++++++
src/main.rs | 7 ++++++-
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index 68b2c43..2884868 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -115,7 +115,9 @@ multi-module surface — applied on `ccectl reload`) and `module { height }` (th
bar height; read by BOTH sides — bar surfaces live via the mtime poll, the
compositor's segment height + reserved strip on `ccectl reload` — falls back to
the shared `layout { bar_height }`) and `module { padding }` (text inset inside
-each module box, bar-side only, falls back to the shared `status_padding`). Everything is read through
+each module box, bar-side only, falls back to the shared `status_padding`) and
+`module { font_size }` (module text size, bar-side only; beats even the size
+embedded in the shared font string, which remains the fallback). Everything is read through
`cce_ui::config::cached_config()`; KDL is converted to JSON
(`cce_ui::config::parse_kdl_to_json`) and looked up with the local `json_find_key`,
which splits snake_case keys across nesting — `status_background_color` matches
diff --git a/src/config.rs b/src/config.rs
index a7a7fc1..6a5aa4b 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -144,6 +144,12 @@ pub(crate) fn read_status_height_from_config() -> f32 {
}
pub(crate) fn read_status_font_size_from_config() -> f32 {
+ // App-native `module { font_size }` wins over everything — including the
+ // size embedded in the shared font string ("Chivo Mono 14"), which stays
+ // the fallback along with the shared status_font_size key.
+ if let Some(size) = cfg_f32("/module/font_size", "module_font_size") {
+ return size;
+ }
if let Some(font_str) = cfg_string("/style/status/font", "status_font") {
let (_, parsed_size) = cce_ui::layout::parse_font_string(&font_str);
if let Some(size) = parsed_size {
diff --git a/src/main.rs b/src/main.rs
index a0e437e..fbd5b34 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -301,7 +301,12 @@ impl StatusApp {
let bar_thickness = read_status_height_from_config() as u32;
cce_ui::BAR_THICKNESS.store(bar_thickness, std::sync::atomic::Ordering::Relaxed);
- let font_family = read_status_font_from_config();
+ // Family WITHOUT the embedded size: the toolkit's text pipeline lets
+ // a size inside the font string ("Chivo Mono 14") override the
+ // explicit font-size parameter, which would dead-end
+ // `module { font_size }`. Size is resolved separately below.
+ let (font_family, _) =
+ cce_ui::layout::parse_font_string(&read_status_font_from_config());
let font_size = read_status_font_size_from_config();
let show_separators = false;
let padding = read_status_padding_from_config();