File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
packages/desktop/src-tauri Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ tauri-plugin-window-state = "2"
2929tauri-plugin-clipboard-manager = " 2"
3030tauri-plugin-http = " 2"
3131tauri-plugin-notification = " 2"
32+ tauri-plugin-single-instance = " 2"
3233
3334serde = { version = " 1" , features = [" derive" ] }
3435serde_json = " 1"
Original file line number Diff line number Diff line change @@ -189,6 +189,13 @@ pub fn run() {
189189 let updater_enabled = option_env ! ( "TAURI_SIGNING_PRIVATE_KEY" ) . is_some ( ) ;
190190
191191 let mut builder = tauri:: Builder :: default ( )
192+ . plugin ( tauri_plugin_single_instance:: init ( |app, _args, _cwd| {
193+ // Focus existing window when another instance is launched
194+ if let Some ( window) = app. get_webview_window ( "main" ) {
195+ let _ = window. set_focus ( ) ;
196+ let _ = window. unminimize ( ) ;
197+ }
198+ } ) )
192199 . plugin ( tauri_plugin_os:: init ( ) )
193200 . plugin ( tauri_plugin_window_state:: Builder :: new ( ) . build ( ) )
194201 . plugin ( tauri_plugin_store:: Builder :: new ( ) . build ( ) )
You can’t perform that action at this time.
0 commit comments