@@ -21,6 +21,7 @@ use tauri_plugin_shell::ShellExt; // for app.shell()
2121use tauri_plugin_store:: Builder as StoreBuilder ;
2222use tauri_plugin_clipboard_manager:: init as clipboard_plugin;
2323use tauri_plugin_opener:: init as opener_plugin;
24+ use tauri_plugin_single_instance:: init as single_instance_plugin;
2425use tokio:: process:: Command as TokioCommand ;
2526
2627mod audio_preprocess;
@@ -75,20 +76,30 @@ fn main() {
7576 . plugin ( shell_plugin ( ) )
7677 . plugin ( clipboard_plugin ( ) )
7778 . plugin ( opener_plugin ( ) )
79+ . plugin ( single_instance_plugin ( |app, _args, _cwd| {
80+ // Focus the existing window when a second instance is launched
81+ let _ = app. get_webview_window ( "main" ) . map ( |w| w. set_focus ( ) ) ;
82+ } ) )
7883 . setup ( |app| {
7984 // Initialize backend logging (file + in-memory ring buffer)
8085 crate :: logging:: init_logging ( & app. handle ( ) ) ;
8186
87+ // Set window title to "AutoSubs" on Windows and Linux for taskbar display
88+ #[ cfg( any( target_os = "windows" , target_os = "linux" ) ) ]
89+ {
90+ if let Some ( window) = app. get_webview_window ( "main" ) {
91+ let _ = window. set_title ( "AutoSubs" ) ;
92+ }
93+ }
94+
8295 // Hide native titlebar on Windows so the custom HTML titlebar is used exclusively
8396 #[ cfg( target_os = "windows" ) ]
8497 {
8598 if let Some ( window) = app. get_webview_window ( "main" ) {
8699 let _ = window. set_decorations ( false ) ;
87- let _ = window. set_title ( "AutoSubs" ) ;
88100 }
89101 }
90102
91-
92103 // Set traffic light position programmatically on macOS.
93104 // `trafficLightPosition` in tauri.conf.json is only applied at window
94105 // creation and AppKit resets the button layout on various lifecycle
0 commit comments