@@ -30,7 +30,7 @@ use cosmic::{
30
30
iced:: {
31
31
self , Length , Subscription ,
32
32
event:: { self , PlatformSpecific } ,
33
- window,
33
+ keyboard , window,
34
34
} ,
35
35
prelude:: * ,
36
36
surface,
@@ -160,6 +160,7 @@ pub enum Message {
160
160
#[ cfg( feature = "wayland" ) ]
161
161
PanelConfig ( CosmicPanelConfig ) ,
162
162
SearchActivate ,
163
+ SearchActivateWith ( String ) ,
163
164
SearchChanged ( String ) ,
164
165
SearchClear ,
165
166
SearchSubmit ,
@@ -297,8 +298,7 @@ impl cosmic::Application for SettingsApp {
297
298
daytime,
298
299
) ) )
299
300
} ) ,
300
- #[ cfg( feature = "wayland" ) ]
301
- event:: listen_with( |event, _, _id| match event {
301
+ event:: listen_with( |event, status, _id| match event {
302
302
#[ cfg( feature = "wayland" ) ]
303
303
iced:: Event :: PlatformSpecific ( PlatformSpecific :: Wayland (
304
304
wayland:: Event :: Output ( wayland:: OutputEvent :: Created ( Some ( info) ) , o) ,
@@ -307,6 +307,13 @@ impl cosmic::Application for SettingsApp {
307
307
iced:: Event :: PlatformSpecific ( PlatformSpecific :: Wayland (
308
308
wayland:: Event :: Output ( wayland:: OutputEvent :: Removed , o) ,
309
309
) ) => Some ( Message :: OutputRemoved ( o) ) ,
310
+ iced:: Event :: Keyboard ( keyboard:: Event :: KeyPressed {
311
+ modifiers: m,
312
+ text: Some ( t) ,
313
+ ..
314
+ } ) if status == event:: Status :: Ignored && !m. control( ) && !m. alt( ) && !m. logo( ) => {
315
+ Some ( Message :: SearchActivateWith ( t. to_string( ) ) )
316
+ }
310
317
_ => None ,
311
318
} ) ,
312
319
#[ cfg( feature = "wayland" ) ]
@@ -354,9 +361,10 @@ impl cosmic::Application for SettingsApp {
354
361
return self . search_changed ( phrase) ;
355
362
}
356
363
357
- Message :: SearchActivate => {
358
- self . search_active = true ;
359
- return cosmic:: widget:: text_input:: focus ( self . search_id . clone ( ) ) ;
364
+ Message :: SearchActivate => return self . on_search ( ) ,
365
+
366
+ Message :: SearchActivateWith ( phrase) => {
367
+ return self . on_search ( ) . chain ( self . search_changed ( phrase) ) ;
360
368
}
361
369
362
370
Message :: SearchClear => {
0 commit comments