From 2085979780cb25213301476629fd568069afe4ee Mon Sep 17 00:00:00 2001 From: ebenali <54529923+ebenali@users.noreply.github.com> Date: Sun, 21 Jun 2026 17:36:30 +0000 Subject: [PATCH] feat: per-place fonts + a live theme preview in wbconf Add Openbox-style font configuration and make wbconf fancier with a live theme/fonts preview. Compositor: - Theme gains FontSpec fields per place (active/inactive title, menu header, menu item, OSD); FontSpec.family is now std::string (safe to own parsed names). The frame/menu/switcher style adapters set each resolved TextStyle.font from them, so a configured title font also drives the titlebar height (frame_metrics measures the label font). - config.cpp parses Openbox //, applied onto the loaded theme. New pure wb::font_place_from_name() maps the Openbox place names (incl. OSD aliases) to FontPlace; unit-tested. wbconf: - New Fonts tab with a GtkFontDialogButton per place; RcDocument reads/writes the structured elements as Pango "Family [Bold] Size" strings (round-trip unit-tested, including create/update/remove). - New live Preview pane on the Theme tab: a GtkDrawingArea that renders sample active/inactive titlebars (with window buttons) and a menu using the SAME theme/style/render pipeline as the compositor, so it is pixel-faithful. It reflects the live, unsaved selection and redraws when the theme or any font changes. wbconf now links style/widget/render in addition to theme. - data/rc.xml documents the block. Tests: font_place_from_name + theme-font-flow + wbconf font round-trip; full suite 27 green (g++/ASan), clang + release clean. Headless: a 20pt title font enlarges the titlebar; wbconf maps with the Fonts tab and the preview renders with no Cairo/Pango/GTK errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- data/rc.xml | 9 +- include/waybox/theme.hpp | 25 ++++- include/waybox/wbconf.hpp | 8 ++ test/style_test.cpp | 19 ++++ test/theme_test.cpp | 17 +++ test/wbconf_test.cpp | 28 +++++ waybox/config.cpp | 63 +++++++++++ waybox/render.cpp | 2 +- waybox/style.cpp | 4 + waybox/theme.cpp | 21 ++++ waybox/wbconf.cpp | 129 ++++++++++++++++++++++ wbconf/main.cpp | 219 +++++++++++++++++++++++++++++++++++++- wbconf/meson.build | 5 +- 13 files changed, 543 insertions(+), 6 deletions(-) diff --git a/data/rc.xml b/data/rc.xml index fa0fecd..7fa4574 100644 --- a/data/rc.xml +++ b/data/rc.xml @@ -11,9 +11,16 @@ + below) to use the built-in default; uncomment and set a name to theme it. + Per-place fonts live here too (Openbox convention): + places are ActiveWindow, InactiveWindow, MenuHeader, MenuItem and + ActiveOnScreenDisplay. The titlebar height tracks the title font size. -->