fix: close secondary windows before main to allow app exit, hide miniplayer on tray

Previous commit removed the miniplayer close from CloseRequested,
but that kept the app alive because Tauri won't exit while windows
remain open. Now closes secondary windows with close() (not
destroy()) in CloseRequested before the main window closes.
Also hides the miniplayer when close-to-tray activates.
This commit is contained in:
vicrodh committed 2026-02-28 07:48:03 -06:00
1 parent b1e4f8db94
commit aff45f98f0
1 file changed
+13
+13
View File
@@ -922,8 +922,21 @@ pub fn run() {
if close_to_tray {
log::info!("Close to tray: hiding window instead of closing");
let _ = window.hide();
// Also hide the miniplayer if open
if let Some(mini) = window.app_handle().webview_windows().get("miniplayer") {
let _ = mini.hide();
}
api.prevent_close();
} else {
// Close secondary windows before the main window closes.
// Use close() (not destroy()) so WebKit can clean up gracefully.
for (label, win) in window.app_handle().webview_windows() {
if label != "main" {
log::info!("App closing: closing secondary window '{}'", label);
let _ = win.close();
}
}
// Cleanup cast devices on actual close
log::info!("App closing: cleaning up cast devices");