Skip to content

feat(wbconf): GTK4 settings GUI (obconf-style) + fix C++ i18n#65

Merged
ebenali merged 3 commits into
masterfrom
feat-wbconf
Jun 21, 2026
Merged

feat(wbconf): GTK4 settings GUI (obconf-style) + fix C++ i18n#65
ebenali merged 3 commits into
masterfrom
feat-wbconf

Conversation

@ebenali

@ebenali ebenali commented Jun 21, 2026

Copy link
Copy Markdown
Member

Adds wbconf, an optional graphical configuration tool for waybox, modelled after Openbox's obconf.

What it does

  • Edits the user's rc.xml in place (preserves keybindings, application rules and comments) through a small libxml2 model, then asks a running waybox to reload via SIGUSR2 (the signal Openbox uses).
  • obconf-style notebook tabs covering the settings waybox actually honours plus our extensions:
    • Appearance — theme (from installed themes), titlebar padding / button size / resize-grab margin
    • Windows — placement policy (Smart / Center / UnderMouse)
    • Margins — reserved screen-edge space
    • Menu (extension) — source, submenu open mode, hover delay, wrap, icons
    • Switcher (extension) — order, OSD, wrap

Structure

  • wb::RcDocument (waybox/wbconf.cpp) — the testable rc.xml model: reads/writes only the managed nodes (standard theme/name, placement/policy, margins as element text; the <waybox> titlebar/menu/switcher extensions as attributes). Round-trip unit-tested.
  • wb::installed_theme_names() — enumerate themes with an openbox-3/themerc.
  • wbconf/main.cpp — GTK4 UI; built only when GTK4 is present (-Dwbconf=auto). Ships a validated wbconf.desktop.

i18n / l10n

Every wbconf string is wrapped in _() with the text domain initialised. Also fixes a post-migration regression: the gettext build defines (USE_NLS/GETTEXT_PACKAGE/LOCALEDIR) were applied only to C, so after the C→C++ port the compositor's own _() strings were no longer translated at runtime — now extended to C++. POTFILES.in refreshed to the .cpp filenames plus wbconf; waybox.pot regenerated.

Testing

  • 27 tests green under g++ (ASan/UBSan), including the new wbconf model round-trip test (read existing, round-trip all settings, in-place update without duplication, clearing removes nodes/attrs, keybindings preserved).
  • clang + --buildtype=release clean (compositor + wbconf).
  • Headless smoke: wbconf maps and populates its window under real Wayland (client of a headless waybox) with no ASan/GTK errors.
  • waybox.pot extraction includes the wbconf strings.

Notes / follow-ups (tracked)

  • A future optional schema-driven editor mode (GtkSourceView raw rc.xml editing with completion + per-field help) is planned, based on Openbox's annotated rc.xsd/menu.xsd extended with a waybox xsd — not WebView.
  • A broader sweep to wrap all remaining post-migration strings in _() is queued.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

ebenali and others added 3 commits June 21, 2026 15:20
Introduce wbconf, an optional graphical configuration tool for waybox modelled
after Openbox's obconf. It edits the user's rc.xml in place through a small,
unit-tested libxml2 model and asks a running waybox to reload (SIGUSR2).

- wb::RcDocument (waybox/wbconf.cpp): loads rc.xml, reads/writes only the
  settings wbconf manages — standard Openbox keys (theme/name, placement/policy,
  margins) and the waybox extensions (titlebar/menu/switcher attributes on
  <waybox> children) — preserving keybindings, app rules and comments. Round-trip
  unit-tested (test/wbconf_test.cpp).
- wb::installed_theme_names(): enumerate themes with an openbox-3/themerc.
- wbconf/main.cpp: GTK4 UI with obconf-style tabs (Appearance, Windows, Margins,
  Menu, Switcher), Save & Apply (writes ~/.config/waybox/rc.xml and signals
  waybox), built only when GTK4 is present (meson feature 'wbconf', auto).
- Ships wbconf.desktop (validated).

i18n: every wbconf string is wrapped in _() and the text domain initialised.
The gettext build defines (USE_NLS/GETTEXT_PACKAGE/LOCALEDIR) were only applied
to C, so after the C->C++ port the compositor's own _() strings were no longer
translated at runtime; extend them to C++ and refresh POTFILES.in to the .cpp
filenames plus wbconf, regenerating waybox.pot.

Tests: 27 green (g++/ASan, incl. the new wbconf model test); clang + release
clean; headless smoke shows the GUI maps and populates under real Wayland with
no ASan/GTK errors; pot extraction includes the wbconf strings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restyle the wbconf GUI to match obconf's visual idiom and wire it into the
default menu like Openbox does with obconf:

- Each tab is now a page of bold section headers ("<span weight='bold'>…")
  over 12px-indented content, matching obconf's layout.
- The Theme tab is a scrolling, browse-selection list of installed themes
  (obconf-style) instead of a drop-down, with the active theme selected.
- Tabs renamed to obconf's vocabulary: Theme, Appearance ("Window Titles"),
  Windows ("Placing Windows"), Margins ("Reserved Screen Margins"), Menu
  ("Root Menu"), Switcher ("Task Switcher").
- data/menu.xml: add a separator and a "Configure" entry that launches wbconf
  in the root menu, mirroring Openbox shipping ObConf in its menu. (Separators
  were already supported by the menu parser/renderer.)

All strings remain wrapped in _() for translation.

Verified: full suite 27 green (g++/ASan); wbconf builds and maps under real
Wayland with the new layout and no GTK/ASan errors; waybox parses the updated
menu (separator + Configure) without error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ebenali
ebenali merged commit fb492be into master Jun 21, 2026
4 checks passed
@ebenali
ebenali deleted the feat-wbconf branch June 21, 2026 15:47
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