File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ use tauri:: Manager ;
2
+
1
3
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
2
4
#[ tauri:: command]
3
5
fn network_connect ( network_id : & str ) -> String {
@@ -7,7 +9,23 @@ fn network_connect(network_id: &str) -> String {
7
9
#[ cfg_attr( mobile, tauri:: mobile_entry_point) ]
8
10
pub fn run ( ) {
9
11
tauri:: Builder :: default ( )
10
- . plugin ( tauri_plugin_single_instance:: init ( ) )
12
+ // NOTE: Currently, plugins run in the order they were added in to the builder,
13
+ // so `tauri_plugin_single_instance` needs to be registered first.
14
+ // See: https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/single-instance
15
+ . plugin ( tauri_plugin_single_instance:: init ( |app, _args, _cwd| {
16
+ #[ cfg( desktop) ]
17
+ {
18
+ let windows = app. webview_windows ( ) ;
19
+ for ( name, window) in windows {
20
+ if name == "main" {
21
+ window. show ( ) . unwrap ( ) ;
22
+ window. unminimize ( ) . unwrap ( ) ;
23
+ window. set_focus ( ) . unwrap ( ) ;
24
+ break ;
25
+ }
26
+ }
27
+ }
28
+ } ) )
11
29
. plugin ( tauri_plugin_store:: Builder :: new ( ) . build ( ) )
12
30
. plugin (
13
31
tauri_plugin_log:: Builder :: new ( )
You can’t perform that action at this time.
0 commit comments