[panel].sections is validated but never read — control panel body is hardcoded #13

Closed
opened 2026-09-05 01:37:07 +08:00 by Breadway · 1 comment
Owner

What's broken

docs/shell-themes.md (bread-ecosystem) documents [panel] as a live theme.toml table:

sections reorders / drops the control-panel's body sections... Default = all six, in the order above... Changing sections forces a restart (the body is assembled once at launch).

bread-theme's resolve_panel() (bread-ecosystem/bread-theme/src/shell/manifest.rs:835) fully parses and validates [panel] — unknown section names are a hard error, min_width and sections both land on ShellTheme::panel().

But ShellTheme::panel() / .sections is never called anywhere in breadbar (confirmed: zero matches for .panel() outside bread-theme/src itself). The control panel body — CONTROL header, volume slider, OUTPUT section, brightness slider, SYSTEM header + stats, power row (lock/sleep/off), tray sections — is fully hardcoded in src/main.rs around lines 1011–1099, built unconditionally in that exact order regardless of what theme.toml says.

breadbar/src/theme.rs::needs_restart() also only compares .modules() and .launcher().mode — it doesn't check panel().sections, consistent with the value never being read at all (there's nothing to restart for).

Impact

A theme author can write [panel] sections = ["volume", "power"] in theme.toml, bread-theme diagnose will report success, and nothing will change — the popover still renders all six sections in the default order. This is a silent no-op: the config is documented, validated, and completely inert.

Fix

Wire theme::shell_theme().panel().sections into the control-panel body assembly in main.rs (build/show each named section, in the given order, drop ones not listed) and add the missing sections comparison to needs_restart() so a live change without a restart doesn't leave the panel stale.

Repro

  1. Set [panel] sections = ["power"] in an active theme.toml.
  2. Restart breadbar.
  3. Open the control panel — expect only the power row; actually see all six default sections.
## What's broken `docs/shell-themes.md` (bread-ecosystem) documents `[panel]` as a live theme.toml table: > `sections` reorders / drops the control-panel's body sections... Default = all six, in the order above... **Changing `sections` forces a restart** (the body is assembled once at launch). `bread-theme`'s `resolve_panel()` (bread-ecosystem/bread-theme/src/shell/manifest.rs:835) fully parses and validates `[panel]` — unknown section names are a hard error, `min_width` and `sections` both land on `ShellTheme::panel()`. But `ShellTheme::panel()` / `.sections` is **never called anywhere in breadbar** (confirmed: zero matches for `.panel()` outside `bread-theme/src` itself). The control panel body — `CONTROL` header, volume slider, `OUTPUT` section, brightness slider, `SYSTEM` header + stats, power row (lock/sleep/off), tray sections — is fully hardcoded in `src/main.rs` around lines 1011–1099, built unconditionally in that exact order regardless of what `theme.toml` says. `breadbar/src/theme.rs::needs_restart()` also only compares `.modules()` and `.launcher().mode` — it doesn't check `panel().sections`, consistent with the value never being read at all (there's nothing to restart *for*). ## Impact A theme author can write `[panel] sections = ["volume", "power"]` in `theme.toml`, `bread-theme diagnose` will report success, and nothing will change — the popover still renders all six sections in the default order. This is a silent no-op: the config is documented, validated, and completely inert. ## Fix Wire `theme::shell_theme().panel().sections` into the control-panel body assembly in `main.rs` (build/show each named section, in the given order, drop ones not listed) and add the missing `sections` comparison to `needs_restart()` so a live change without a restart doesn't leave the panel stale. ## Repro 1. Set `[panel] sections = ["power"]` in an active `theme.toml`. 2. Restart breadbar. 3. Open the control panel — expect only the power row; actually see all six default sections.
Author
Owner

False alarm — filed against a stale local clone of main that hadn't fetched origin. This was already fixed by PR #12 (feature/theme-ui-control, merged 2026-09-04 as bd3d5b4): src/main.rs:1134 now builds panel sections from theme::shell_theme().panel().sections, and theme.rs::needs_restart compares panel().sections. Verified against origin/main (083ae51) with cargo test --release — 44/44 passing. Closing.

False alarm — filed against a stale local clone of `main` that hadn't fetched origin. This was already fixed by PR #12 (`feature/theme-ui-control`, merged 2026-09-04 as `bd3d5b4`): `src/main.rs:1134` now builds panel sections from `theme::shell_theme().panel().sections`, and `theme.rs::needs_restart` compares `panel().sections`. Verified against `origin/main` (083ae51) with `cargo test --release` — 44/44 passing. Closing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/breadbar#13
No description provided.