Desktop theme watcher starts only in the desktop app, not in every SheetApp (tests, embedders) (review fix-up for #203)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas 2026-10-11 15:09:43 -04:00
parent 0bea7178a2
commit 55d41eb13c
2 changed files with 8 additions and 1 deletions

View File

@ -272,6 +272,7 @@ fn main() -> eframe::Result<()> {
session.new_workbook();
}
let mut app = SheetApp::new(session, services());
app.watch_desktop_theme();
app.after_engine(); // Show warnings from files opened on the command line.
let control_port = control_port;
load_prefs(&mut app);

View File

@ -234,7 +234,7 @@ impl SheetApp {
fonts_set: false,
fonts_han: None,
effective_dark: false,
desktop_theme: desktop_theme::DesktopTheme::start(),
desktop_theme: desktop_theme::DesktopTheme::default(),
desktop_dark: None,
name_box: None,
keytips: keytips::KeyTips::default(),
@ -338,6 +338,12 @@ impl SheetApp {
}
/// Runs a command and shows its error in a message box (for menu/ribbon clicks).
/// Follow the desktop's light/dark choice while the app runs (Linux; the desktop app calls
/// this once — tests and embedders don't start the watcher thread).
pub fn watch_desktop_theme(&mut self) {
self.desktop_theme = desktop_theme::DesktopTheme::start();
}
pub fn run_or_alert(&mut self, id: &str, params: Json) {
// Printing from the UI also hands the PDF to the host's print flow (web).
if id == "file.print" {