Skip to content

Commit

Permalink
Close App on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
namanlp authored and krlvi committed Feb 21, 2024
1 parent 0084b1b commit b305cdb
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions gitbutler-app/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fn main() {

tauri::Builder::default()
.on_window_event(|event| {
#[cfg(target_os = "macos")]
if let tauri::WindowEvent::CloseRequested { api, .. } = event.event() {
hide_window(&event.window().app_handle()).expect("Failed to hide window");
api.prevent_close();
Expand Down Expand Up @@ -233,19 +234,8 @@ fn create_window(handle: &tauri::AppHandle) -> tauri::Result<tauri::Window> {
Ok(window)
}

#[cfg(target_os = "macos")]
fn hide_window(handle: &tauri::AppHandle) -> tauri::Result<()> {
#[cfg(target_os = "macos")]
handle.hide()?;

#[cfg(not(target_os = "macos"))]
if let Some(window) = get_window(handle) {
window.hide()?;
}

Ok(())
}

#[cfg(not(target_os = "macos"))]
fn get_window(handle: &tauri::AppHandle) -> Option<tauri::Window> {
handle.get_window("main")
}

0 comments on commit b305cdb

Please sign in to comment.