From 0cb27ec1c47b647e42bc1e5830b68be63bacf59c Mon Sep 17 00:00:00 2001 From: Breadway Date: Tue, 16 Jun 2026 16:56:52 +0800 Subject: [PATCH] theme: load the shared bread-theme stylesheet Call bread_theme::gtk::apply_shared() before breadbar's own rules so fonts, palette, and generic widgets come from the one ecosystem stylesheet (and recolour live). Keep only breadbar-specific CSS (bar window, workspace buttons, stats, notifications, OSD). Bump bread-theme dep to v0.2.6. --- Cargo.toml | 2 +- src/theme.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 755020b..ec2f241 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["wayland", "hyprland", "bar", "status-bar", "gtk4"] categories = ["gui"] [dependencies] -bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.1.0", features = ["gtk"] } +bread-theme = { git = "https://github.com/Breadway/bread-ecosystem", tag = "v0.2.6", features = ["gtk"] } gtk4 = { version = "0.11", features = ["v4_12"] } gtk4-layer-shell = "0.8" relm4 = { version = "0.11", features = ["macros"] } diff --git a/src/theme.rs b/src/theme.rs index 747ca1d..820b69a 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -9,9 +9,10 @@ thread_local! { fn load_css() -> String { let p = load_palette(); + // breadbar-specific rules only — fonts, base colours, and generic widgets + // come from the shared ecosystem stylesheet (applied first in `apply()`). format!( - "* {{ font-family: 'Varela Round', sans-serif; font-size: 14px; }}\ - window.breadbar {{ background-color: {bg_rgba}; border-radius: 0; }}\ + "window.breadbar {{ background-color: {bg_rgba}; border-radius: 0; }}\ label {{ color: {fg}; }}\ .workspace-btn {{ background: transparent; color: {fg}; opacity: 0.45;\ border-radius: 0; border: none; outline: none; box-shadow: none;\ @@ -50,6 +51,10 @@ pub fn fg_color() -> String { /// Apply (or reload) the theme CSS. Safe to call from `glib::MainContext::invoke`. pub fn apply() { + // Shared ecosystem base (fonts, palette, generic widgets) — applied first + // so breadbar's own rules below layer on top. + bgtk::apply_shared(); + let css = load_css(); PROVIDER.with(|cell| bgtk::apply_css(&css, cell));