From 54751ac1c98f1da5da81cbea8524bf7b5480a2c9 Mon Sep 17 00:00:00 2001 From: Breadway Date: Tue, 1 Sep 2026 14:55:16 +0800 Subject: [PATCH] fix: overlay paints opaque @bg; add a tracing subscriber Same `bind_window_auto` clobber as breadbox / breadclip: the full-screen overlay's `window { background-color: transparent }` (APPLICATION priority) loses to the shared component sheet's `window { background-color: @bg }`, re-broadcast at USER-10 by `bind_window_auto`, so the search popup fills the whole screen with an opaque #0c0c0c rectangle. Switch to `bind_window_auto_with_app_css` (rides at USER-9). Also add a tracing subscriber to the `breadsearch` binary so bread-theme / bread-utils `warn!`s aren't dropped (breadmill already had one). --- Cargo.lock | 1 + breadsearch/Cargo.toml | 3 +++ breadsearch/src/main.rs | 20 +++++++++++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 77a2b16..fed70b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,6 +272,7 @@ dependencies = [ "gtk4", "gtk4-layer-shell", "serde_json", + "tracing-subscriber", ] [[package]] diff --git a/breadsearch/Cargo.toml b/breadsearch/Cargo.toml index 2c11e28..bde2ecd 100644 --- a/breadsearch/Cargo.toml +++ b/breadsearch/Cargo.toml @@ -20,3 +20,6 @@ gtk4-layer-shell = "0.8" serde_json = "1" clap = { version = "4", features = ["derive"] } anyhow = "1" +# Subscriber for bread-theme / bread-utils `tracing` events — dropped +# silently without one. env-filter for RUST_LOG. +tracing-subscriber = { version = "0.3", features = ["env-filter"] } diff --git a/breadsearch/src/main.rs b/breadsearch/src/main.rs index 53302ec..882bb6e 100644 --- a/breadsearch/src/main.rs +++ b/breadsearch/src/main.rs @@ -197,7 +197,15 @@ fn run_ui(screenshot_req: Option) { // Full-screen transparent overlay; panel widget is positioned inside it. let window = bread_utils::gtk_popup::new_overlay_window(app, "breadsearch"); - bread_theme::gtk::bind_window_auto(&window); + // Bind the *app* sheet, not just the shared one. `bind_window_auto` + // alone re-broadcasts the shared component sheet — including + // `window { background-color: @bg }` — at USER-10, outranking the + // APPLICATION-priority `window { background-color: transparent }` here + // regardless of specificity: the "transparent overlay" then paints a + // solid @bg rectangle over the whole screen (worst under a VM's + // software renderer). `_with_app_css` rides our sheet at USER-9. Same + // fix as breadbox / breadclip. + bread_theme::gtk::bind_window_auto_with_app_css(&window, build_css); let close_all: Rc = Rc::new({ let w = window.clone(); @@ -369,6 +377,16 @@ fn run_ui(screenshot_req: Option) { // ---- Main ------------------------------------------------------------------- fn main() { + // Surface bread-theme / bread-utils `tracing::warn!` (dropped silently + // before). `RUST_LOG` overrides; default warn+. + tracing_subscriber::fmt() + .with_env_filter( + tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("warn")), + ) + .with_writer(std::io::stderr) + .init(); + if std::env::args().nth(1).as_deref() == Some("listen") { listen::run(); return;