Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,26 @@ pub fn run() {
// this should always be the first
#[cfg(desktop)]
let builder = builder.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
let handle = app.clone();
std::thread::spawn(move || {
let app_handle = handle.clone();
let _ = handle.run_on_main_thread(move || {
let _ = show_or_create_main_window(&app_handle);
#[cfg(windows)]
{
let handle = app.clone();
std::thread::spawn(move || {
let app_handle = handle.clone();
let scheduled = handle.run_on_main_thread(move || {
if let Err(error) = show_or_create_main_window(&app_handle) {
log::warn!("Failed to show main window for second instance: {error}");
}
});
if let Err(error) = scheduled {
log::warn!("Failed to schedule main window show for second instance: {error}");
}
});
});
}

#[cfg(not(windows))]
if let Err(error) = show_or_create_main_window(app) {
log::warn!("Failed to show main window for second instance: {error}");
}
}));

// macOS needs a standard menu (with the Edit submenu) for keyboard
Expand Down
Loading