bread-theme: generate Hyprland layer rules from the shell theme (Phase 4a)
Adds `bread-theme layerrules`, which writes the active shell theme's [compositor] table to ~/.config/hypr/layerrules.json (atomic write). This lets ~/.config/hypr/scripts/ui/rules.lua read theme-driven blur/transparency/ animation for the breadbar/breadbox layer-shell namespaces instead of having them hardcoded, following THEME_SYSTEM_PLAN.md §9. rules.lua keeps its previous hardcoded rules as a pcall-guarded fallback for when the JSON is missing or malformed (lives outside this repo, so not part of this commit). Also fixes a pre-existing test race: shell::tests and the new layerrules::tests both mutate XDG_CONFIG_HOME in parallel `cargo test` threads but previously used separate, unrelated locks (or none), so they could observe each other's env var changes mid-test. Both now share bread_theme::test_support::XDG_CONFIG_HOME_LOCK.
This commit is contained in:
parent
92d3362a6b
commit
ea9758a5d5
6 changed files with 241 additions and 14 deletions
|
|
@ -2,10 +2,12 @@
|
|||
pub mod adw;
|
||||
#[cfg(feature = "gtk")]
|
||||
pub mod gtk;
|
||||
mod layerrules;
|
||||
mod output;
|
||||
pub mod palette;
|
||||
pub mod shell;
|
||||
|
||||
pub use layerrules::{layerrules_json, layerrules_path, write_layerrules, write_layerrules_active};
|
||||
pub use output::{
|
||||
generate_output, load_palette_for, output_css_path, output_palette_path, palette_from_image,
|
||||
palette_from_json, palettes_dir, sanitize_output, themes_dir, write_output_css,
|
||||
|
|
@ -13,6 +15,19 @@ pub use output::{
|
|||
};
|
||||
pub use palette::{load_palette, Palette};
|
||||
|
||||
/// Env-var locks shared by any test module that mutates process-global
|
||||
/// state (`std::env::set_var`) — `cargo test` runs a crate's tests in
|
||||
/// parallel by default, so every module touching the *same* env var must
|
||||
/// serialize through the *same* lock or their mutations race each other's
|
||||
/// reads. `bread_theme::output`'s own `XDG_ENV_LOCK` guards `XDG_RUNTIME_DIR`
|
||||
/// specifically and stays where it is; `XDG_CONFIG_HOME_LOCK` here is the
|
||||
/// one shared by `shell::tests` and `layerrules::tests`, which both point
|
||||
/// `XDG_CONFIG_HOME` at an isolated temp dir.
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test_support {
|
||||
pub(crate) static XDG_CONFIG_HOME_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
}
|
||||
|
||||
/// Design tokens from BREAD_DESIGN_SYSTEM.md.
|
||||
pub mod tokens {
|
||||
pub const FONT_FAMILY: &str = "Varela Round, sans-serif";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue