mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
feat(tauri): hide main window to tray on Windows close (#1583)
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
co-authored by
Matt Van Horn
Steven Enamakel
parent
721cb2b64c
commit
d9da5bfc09
@@ -2120,6 +2120,20 @@ pub fn run() {
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
RunEvent::WindowEvent {
|
||||
label,
|
||||
event: WindowEvent::CloseRequested { api, .. },
|
||||
..
|
||||
} if label == "main" => {
|
||||
log::info!(
|
||||
"[window] close requested on main window — hiding to tray instead of destroying"
|
||||
);
|
||||
api.prevent_close();
|
||||
if let Some(window) = app_handle.get_webview_window("main") {
|
||||
let _ = window.hide();
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
RunEvent::Reopen { .. } => {
|
||||
log::info!("[window] reopen event — showing main window");
|
||||
|
||||
Reference in New Issue
Block a user