From a56110e52224069848733b0146a5488554e99772 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 2 Sep 2026 12:01:59 +0800 Subject: [PATCH] listen: re-read the shell theme per open, not once per process `breadbox listen` is the one long-lived breadbox invocation; every other one is a one-shot window that reads the theme fresh at startup anyway. `crate::theme::shell_theme()` caches `shell::load()` for the process lifetime, so after a shell-theme switch `listen` kept deciding embedded-vs-spawn against the old theme until restarted. It has no glib main loop to run `shell::watch()`; re-reading on each `open` (rare, user-driven) is the simple fix. --- breadbox/src/listen.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/breadbox/src/listen.rs b/breadbox/src/listen.rs index e626532..66d3097 100644 --- a/breadbox/src/listen.rs +++ b/breadbox/src/listen.rs @@ -72,7 +72,15 @@ fn handle_open() { // own output) and emit a distinct, explicitly-unconfirmed event so a bus // observer can tell "redirected, outcome unknown" apart from "breadbox // spawned" rather than being told a specific untrue thing. - if crate::theme::shell_theme().launcher().mode == bread_theme::shell::LauncherMode::Embedded { + // Read the theme fresh, NOT via `crate::theme::shell_theme()`: that + // accessor caches `shell::load()` for the life of the process, and + // `breadbox listen` is long-lived (unlike every other breadbox + // invocation, which is a one-shot window). If the user switches shell + // themes while `listen` is running, a cached value here would make the + // wrong embedded-vs-spawn decision until the next restart. `listen` has + // no glib main loop, so it can't run `shell::watch()`; re-reading on + // each `open` (a rare, user-driven event) is the simplest correct fix. + if bread_theme::shell::load().launcher().mode == bread_theme::shell::LauncherMode::Embedded { eprintln!( "breadbox: bread.command.box.open received under an embedded launcher \ theme; breadbar's capsule is the intended handler and this process \