Skip to content

Commit 216f14d

Browse files
committed
feat: handle app reopening from dock icon click and restore visibility on macOS
1 parent 7755853 commit 216f14d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src-tauri/src/lib.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,21 @@ pub fn run() {
11281128
let _ = app_handle.track_event("app_exited", None);
11291129
app_handle.flush_events_blocking();
11301130
}
1131+
tauri::RunEvent::Reopen { .. } => {
1132+
// When the user clicks on the dock icon, show the window
1133+
if let Some(window) = app_handle.get_webview_window("main") {
1134+
let _ = window.show();
1135+
let _ = window.set_focus();
1136+
// If the app was previously hidden from dock, restore it
1137+
#[cfg(target_os = "macos")]
1138+
{
1139+
let app_handle_clone = app_handle.clone();
1140+
tauri::async_runtime::spawn(async move {
1141+
let _ = set_dock_visibility(app_handle_clone, true).await;
1142+
});
1143+
}
1144+
}
1145+
}
11311146
_ => {}
11321147
});
11331148
})

0 commit comments

Comments
 (0)