Add bread_theme::shell manifest system (Phase 1)

Implements the shell theme manifest layer from THEME_SYSTEM_PLAN.md
§4-5: ShellTheme/WindowSpec/Slots/Tokens/LayerRule types, TOML
discovery (user -> system -> compiled-in builtin), one level of
`extends` deep-merge, deny_unknown_fields validation naming the
offending key, slot module-name validation, and css() token
substitution with an extra.css overlay. load() never fails, falling
back to the compiled-in builtin and logging once.

Ships exactly one builtin manifest, liquid-motion, describing
breadbar/breadbox as they exist today (not the design-doc demo, which
disagrees with the code on bar side margin, launcher geometry, and the
easing curves). Compositor rules and surface specs are keyed by
layer-shell namespace and cover all five breadbar namespaces plus
breadbox/breadbar-panel/breadbar-dismiss.

watch() is gated behind the existing `gtk` feature (gio::FileMonitor
is a gtk4 dependency); the rest of the module is gtk-free so bread and
breadcrumbs can validate a theme without linking GTK. No consumer
changes — breadbar/breadbox still use their own hardcoded values.
This commit is contained in:
Breadway 2026-08-23 15:21:08 +08:00
parent 347f356b1d
commit 96aa6a513b
10 changed files with 2097 additions and 0 deletions

View file

@ -0,0 +1,23 @@
//! The one compiled-in theme (plan §11 phase 1: "**One** built-in manifest
//! (`liquid-motion`) describing the bar as it exists today"). Both files are
//! plain data, not Rust — `theme.toml` is the manifest text a user override
//! would otherwise supply, and `liquid-motion.css` is the CSS template
//! `ShellTheme::css` substitutes tokens into (see that method's doc comment
//! for why this template is a representative subset of `breadbar::theme::
//! load_css`'s full stylesheet rather than a byte-for-byte copy of it).
//!
//! Both are read with `include_str!` so a broken build can't ship without
//! them, and so [`super::builtin`] never touches the filesystem — it must
//! work identically whether or not `$XDG_CONFIG_HOME` exists at all.
pub const LIQUID_MOTION_ID: &str = "liquid-motion";
pub const LIQUID_MOTION_TOML: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/assets/shell/liquid-motion/theme.toml"
));
pub const LIQUID_MOTION_CSS: &str = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/assets/shell/liquid-motion/liquid-motion.css"
));