diff --git a/breadman/src/main.rs b/breadman/src/main.rs index efd5b3f..75232eb 100644 --- a/breadman/src/main.rs +++ b/breadman/src/main.rs @@ -373,7 +373,7 @@ fn build_app_window( .default_width(960) .default_height(640) .build(); - bread_theme::gtk::bind_window_auto(&window); + breadpad_shared::theme::bind_window(&window); let hbox = gtk4::Box::builder() .orientation(gtk4::Orientation::Horizontal) @@ -616,7 +616,7 @@ fn show_add_note_window(parent: >k4::ApplicationWindow, state: AppState, prese .modal(true) .default_width(500) .build(); - bread_theme::gtk::bind_window_auto(&win); + breadpad_shared::theme::bind_window(&win); let vbox = gtk4::Box::builder() .orientation(gtk4::Orientation::Vertical) diff --git a/breadpad-shared/src/theme.rs b/breadpad-shared/src/theme.rs index f7e2177..ab6d81d 100644 --- a/breadpad-shared/src/theme.rs +++ b/breadpad-shared/src/theme.rs @@ -14,8 +14,19 @@ pub fn apply_live() { } /// Bind a window to the palette of the monitor it is rendered on. +/// +/// [`bind_window_auto`] alone attaches only the per-output *shared* sheet, so +/// breadpad/breadman's own component rules (which resolve `@bg`, `@accent`, +/// `@blue`, … from the display-global `@define-color` block) keep the +/// session-global palette on a monitor whose wallpaper differs. Passing +/// [`build_css`] to `bind_window_auto_with_app_css` rebuilds the app sheet +/// against the per-output palette and inlines those names to hex for the bound +/// widget tree. [`apply_live`] stays as the display-level / SIGHUP fallback. pub fn bind_window(window: &impl gtk4::prelude::IsA) { - bread_theme::gtk::bind_window_auto(window); + bread_theme::gtk::bind_window_auto_with_app_css(window, |palette| { + let user_css = std::fs::read_to_string(crate::config::style_css_path()).ok(); + build_css(palette, user_css.as_deref()) + }); } /// Generate the full breadpad/breadman CSS string. The base — `@define-color`