From 021d51ddce930f41425eface0cdd91f3570a908f Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 26 Nov 2026 22:12:18 -0600 Subject: [PATCH] Ctrl+Q quits even with close to tray; on Wayland closing quits (no hiding there) until S047 Co-Authored-By: Claude Opus 5.5 --- crates/app/src/app.rs | 8 +++++++- crates/app/src/shell.rs | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/app/src/app.rs b/crates/app/src/app.rs index fd280d3..9ea9a95 100644 --- a/crates/app/src/app.rs +++ b/crates/app/src/app.rs @@ -397,7 +397,13 @@ impl App { let on = self.settings.mode == medlar_core::settings::Mode::Snail; self.main.toasts.info("slow_motion_video", if on { tr!("snail.on") } else { tr!("snail.off") }); } - Action::Quit => ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close), + Action::Quit => { + // Quitting closes for real, even with close to tray on. + if let Some(shell) = &mut self.shell { + shell.quitting = true; + } + ui.ctx().send_viewport_cmd(egui::ViewportCommand::Close); + } other => { let anywhere = matches!(other, Action::ResumeAll | Action::PauseAll); if self.screen.is_some() && !anywhere { diff --git a/crates/app/src/shell.rs b/crates/app/src/shell.rs index 2d2a568..7cd75ba 100644 --- a/crates/app/src/shell.rs +++ b/crates/app/src/shell.rs @@ -60,7 +60,9 @@ impl Shell { /// Whether closing the window hides it instead. pub fn hides_on_close(&self, settings: &Settings) -> bool { - !self.quitting && settings.close_to_tray && self.tray.is_some() + // Wayland can't hide a window, so a cancelled close would leave it stuck: close quits there until S047. + let can_hide = std::env::var_os("WAYLAND_DISPLAY").is_none(); + !self.quitting && can_hide && settings.close_to_tray && self.tray.is_some() } /// Once per frame: what was asked comes back, what changed goes out.