@@ -165,6 +165,7 @@ impl CosmicLauncher {
165
165
self . input_value . clear ( ) ;
166
166
self . focused = 0 ;
167
167
self . alt_tab = false ;
168
+ self . wait_for_result = false ;
168
169
169
170
// XXX The close will reset the launcher, but the search will restart it so it's ready
170
171
// for the next time it's opened.
@@ -325,6 +326,8 @@ impl cosmic::Application for CosmicLauncher {
325
326
( & self . tx , self . launcher_items . get ( i. unwrap_or ( self . focused ) ) )
326
327
{
327
328
let _res = tx. blocking_send ( launcher:: Request :: Activate ( item. id ) ) ;
329
+ } else {
330
+ return self . hide ( ) ;
328
331
}
329
332
}
330
333
#[ allow( clippy:: cast_possible_wrap) ]
@@ -424,6 +427,9 @@ impl cosmic::Application for CosmicLauncher {
424
427
}
425
428
}
426
429
pop_launcher:: Response :: Update ( mut list) => {
430
+ if self . alt_tab && self . wait_for_result && list. is_empty ( ) {
431
+ return self . hide ( ) ;
432
+ }
427
433
list. sort_by ( |a, b| {
428
434
let a = i32:: from ( a. window . is_none ( ) ) ;
429
435
let b = i32:: from ( b. window . is_none ( ) ) ;
@@ -530,7 +536,7 @@ impl cosmic::Application for CosmicLauncher {
530
536
) -> iced:: Command < cosmic:: app:: Message < Self :: Message > > {
531
537
match msg. msg {
532
538
DbusActivationDetails :: Activate => {
533
- if self . active_surface {
539
+ if self . active_surface || self . wait_for_result {
534
540
return self . hide ( ) ;
535
541
} else if self . last_hide . elapsed ( ) . as_millis ( ) > 100 {
536
542
if let Some ( tx) = & self . tx {
@@ -556,6 +562,9 @@ impl cosmic::Application for CosmicLauncher {
556
562
tracing:: info!( "NOT FOUND" ) ;
557
563
}
558
564
if self . active_surface {
565
+ if self . launcher_items . is_empty ( ) {
566
+ return cosmic:: command:: message ( cosmic:: app:: message:: app ( Message :: Hide ) ) ;
567
+ }
559
568
return cosmic:: command:: message ( cosmic:: app:: message:: app ( Message :: AltTab ) ) ;
560
569
}
561
570
@@ -887,7 +896,7 @@ impl cosmic::Application for CosmicLauncher {
887
896
}
888
897
Key :: Named ( Named :: Escape ) => Some ( Message :: Hide ) ,
889
898
Key :: Named ( Named :: Tab ) => Some ( Message :: TabRelease ) ,
890
- Key :: Named ( Named :: Alt ) => Some ( Message :: AltRelease ) ,
899
+ Key :: Named ( Named :: Alt | Named :: Super ) => Some ( Message :: AltRelease ) ,
891
900
_ => None ,
892
901
} ,
893
902
cosmic:: iced:: Event :: Keyboard ( iced:: keyboard:: Event :: KeyPressed {
0 commit comments