From 7ee34b503e0ea3bbaeb067fce5cf37b0f760bb1f Mon Sep 17 00:00:00 2001 From: Erwan Leboucher Date: Wed, 5 Aug 2026 14:02:59 +0200 Subject: [PATCH] fix(tauri): register single-instance plugin first --- src-tauri/src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 0d51c14d8..3dc6250fd 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -278,6 +278,12 @@ pub fn run() { let builder = tauri::Builder::::new(); + // this should always be the first + #[cfg(desktop)] + let builder = builder.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| { + let _ = show_or_create_main_window(app); + })); + // macOS needs a standard menu (with the Edit submenu) for keyboard // copy/paste/select-all to work in the webview. It lives in the system menu // bar, so it is macOS-only to avoid an in-window menu bar elsewhere. @@ -306,11 +312,6 @@ pub fn run() { desktop::windows::window_tracking::TrackingState::new(), )); - #[cfg(desktop)] - let builder = builder.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| { - let _ = show_or_create_main_window(app); - })); - let builder = builder.plugin(tauri_plugin_notifications::init()); #[cfg(all(desktop, feature = "updater"))]