Skip to content

feat: per-place fonts + live theme preview in wbconf#71

Merged
ebenali merged 1 commit into
masterfrom
feat-fonts-and-preview
Jun 21, 2026
Merged

feat: per-place fonts + live theme preview in wbconf#71
ebenali merged 1 commit into
masterfrom
feat-fonts-and-preview

Conversation

@ebenali

@ebenali ebenali commented Jun 21, 2026

Copy link
Copy Markdown
Member

Adds Openbox-style per-place font configuration (you asked for font family/size selection) and makes wbconf fancier with a live, pixel-faithful theme preview.

Compositor — honour rc.xml fonts

waybox previously used a hardcoded sans 10pt everywhere. Now:

  • Theme gains a FontSpec per place (active/inactive title, menu header, menu item, OSD); FontSpec.family is now std::string so parsed names are safely owned.
  • The frame/menu/switcher style adapters set each resolved TextStyle.font from them — so a configured title font also drives the titlebar height (the metrics measure the label font).
  • config.cpp parses the Openbox <theme><font place="..."><name>/<size>/<weight> block onto the loaded theme. New pure wb::font_place_from_name() maps the place names (incl. OSD aliases); unit-tested.

wbconf — fonts + preview (fancier)

  • Fonts tab: a GtkFontDialogButton per place. RcDocument reads/writes the structured <font> elements as Pango "Family [Bold] Size" strings (round-trip unit-tested, incl. create/update/remove).
  • 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's pixel-faithful. It reflects the live, unsaved selection and redraws when the theme or any font changes. wbconf now links style/widget/render.
  • data/rc.xml documents the <font> block.

Testing

  • New unit tests: font_place_from_name, theme-font → resolved-style flow, and wbconf <font> round-trip.
  • Full suite 27 green (g++/ASan/UBSan); clang + release clean.
  • Headless: a 20pt title font visibly 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

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 <theme><font place="..."><name>/<size>/<weight>,
  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 <font> 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 <font> 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>
@ebenali
ebenali merged commit 3f92d48 into master Jun 21, 2026
4 checks passed
@ebenali
ebenali deleted the feat-fonts-and-preview branch June 21, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant