@@ -2386,10 +2386,34 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {
23862386 window_ids. ids . lock ( ) . unwrap ( ) . retain ( |( _, _id) | * _id != id) ;
23872387
23882388 tokio:: spawn ( EditorInstances :: remove ( window. clone ( ) ) ) ;
2389+
2390+ #[ cfg( target_os = "windows" ) ]
2391+ if CapWindowId :: Settings . get ( & app) . is_none ( ) {
2392+ reopen_main_window ( & app) ;
2393+ }
23892394 }
2390- CapWindowId :: Settings
2391- | CapWindowId :: Upgrade
2392- | CapWindowId :: ModeSelect => {
2395+ CapWindowId :: Settings => {
2396+ for ( label, window) in app. webview_windows ( ) {
2397+ if let Ok ( id) = CapWindowId :: from_str ( & label)
2398+ && matches ! (
2399+ id,
2400+ CapWindowId :: TargetSelectOverlay { .. }
2401+ | CapWindowId :: Main
2402+ | CapWindowId :: Camera
2403+ )
2404+ {
2405+ let _ = window. show ( ) ;
2406+ }
2407+ }
2408+
2409+ #[ cfg( target_os = "windows" ) ]
2410+ if !has_open_editor_window ( & app) {
2411+ reopen_main_window ( & app) ;
2412+ }
2413+
2414+ return ;
2415+ }
2416+ CapWindowId :: Upgrade | CapWindowId :: ModeSelect => {
23932417 for ( label, window) in app. webview_windows ( ) {
23942418 if let Ok ( id) = CapWindowId :: from_str ( & label)
23952419 && matches ! (
@@ -2508,6 +2532,30 @@ pub async fn run(recording_logging_handle: LoggingHandle, logs_dir: PathBuf) {
25082532 } ) ;
25092533}
25102534
2535+ #[ cfg( target_os = "windows" ) ]
2536+ fn has_open_editor_window ( app : & AppHandle ) -> bool {
2537+ app. webview_windows ( )
2538+ . keys ( )
2539+ . any ( |label| matches ! ( CapWindowId :: from_str( label) , Ok ( CapWindowId :: Editor { .. } ) ) )
2540+ }
2541+
2542+ #[ cfg( target_os = "windows" ) ]
2543+ fn reopen_main_window ( app : & AppHandle ) {
2544+ if let Some ( main) = CapWindowId :: Main . get ( app) {
2545+ let _ = main. show ( ) ;
2546+ let _ = main. set_focus ( ) ;
2547+ } else {
2548+ let handle = app. clone ( ) ;
2549+ tokio:: spawn ( async move {
2550+ let _ = ShowCapWindow :: Main {
2551+ init_target_mode : None ,
2552+ }
2553+ . show ( & handle)
2554+ . await ;
2555+ } ) ;
2556+ }
2557+ }
2558+
25112559async fn resume_uploads ( app : AppHandle ) -> Result < ( ) , String > {
25122560 let recordings_dir = recordings_path ( & app) ;
25132561 if !recordings_dir. exists ( ) {
0 commit comments