Merge pull request 'Bind per-output app CSS for breadpad and breadman windows' (#1) from fix/per-monitor-app-css into main
This commit is contained in:
commit
a0cce3f5c5
2 changed files with 14 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<gtk4::Native>) {
|
||||
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`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue