Skip to content

Commit

Permalink
Branch window hide function according to OS
Browse files Browse the repository at this point in the history
  • Loading branch information
parksb committed Aug 25, 2023
1 parent 4fcc13c commit 4074fd4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,19 @@ fn main() {
})
.on_window_event(|event| {
if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() {
hide_window(&event);
api.prevent_close();
let _ = event.window().app_handle().hide();
}
})
.run(tauri::generate_context!("tauri.conf.json"));
}

#[cfg(target_os = "macos")]
fn hide_window(event: &tauri::GlobalWindowEvent) {
let _ = event.window().app_handle().hide();
}

#[cfg(not(target_os = "macos"))]
fn hide_window(event: &tauri::GlobalWindowEvent) {
event.window().hide().unwrap();
}

0 comments on commit 4074fd4

Please sign in to comment.