mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
fix(tauri): hide instead of destroy main window on Windows close (OPENHUMAN-TAURI-2X) (#1548)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
co-authored by
Claude Opus 4.7
Steven Enamakel
parent
54a9396f88
commit
3bfe53aaa9
@@ -31,7 +31,7 @@ mod webview_apis;
|
||||
mod whatsapp_scanner;
|
||||
mod window_state;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
use tauri::WindowEvent;
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
use tauri::{
|
||||
@@ -2078,7 +2078,16 @@ pub fn run() {
|
||||
);
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
// Intercept the main window's close request on macOS AND Windows
|
||||
// so the user can re-open the app from the tray icon. Letting the
|
||||
// OS destroy the webview makes `get_webview_window("main")` return
|
||||
// None on the next tray-click and surfaces as
|
||||
// `[tray] failed to show main window from tray click: main window
|
||||
// not found` (OPENHUMAN-TAURI-2X — 21 events, Windows only).
|
||||
// Linux is left out: `setup_tray` early-returns on Linux because
|
||||
// tray creation panics inside GTK during packaged runs, so the
|
||||
// hide-on-close behavior would strand the user with no way back.
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
RunEvent::WindowEvent {
|
||||
label,
|
||||
event: WindowEvent::CloseRequested { api, .. },
|
||||
|
||||
Reference in New Issue
Block a user