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.
This commit is contained in:
Breadway 2026-06-16 16:56:52 +08:00
parent 1959a86157
commit 0cb27ec1c4
2 changed files with 8 additions and 3 deletions

View file

@ -10,7 +10,7 @@ keywords = ["wayland", "hyprland", "bar", "status-bar", "gtk4"]
categories = ["gui"] categories = ["gui"]
[dependencies] [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 = { version = "0.11", features = ["v4_12"] }
gtk4-layer-shell = "0.8" gtk4-layer-shell = "0.8"
relm4 = { version = "0.11", features = ["macros"] } relm4 = { version = "0.11", features = ["macros"] }

View file

@ -9,9 +9,10 @@ thread_local! {
fn load_css() -> String { fn load_css() -> String {
let p = load_palette(); 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!( 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}; }}\ label {{ color: {fg}; }}\
.workspace-btn {{ background: transparent; color: {fg}; opacity: 0.45;\ .workspace-btn {{ background: transparent; color: {fg}; opacity: 0.45;\
border-radius: 0; border: none; outline: none; box-shadow: none;\ 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`. /// Apply (or reload) the theme CSS. Safe to call from `glib::MainContext::invoke`.
pub fn apply() { 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(); let css = load_css();
PROVIDER.with(|cell| bgtk::apply_css(&css, cell)); PROVIDER.with(|cell| bgtk::apply_css(&css, cell));