@@ -30,7 +30,7 @@ use cosmic::{
3030 iced:: {
3131 self , Length , Subscription ,
3232 event:: { self , PlatformSpecific } ,
33- window,
33+ keyboard , window,
3434 } ,
3535 prelude:: * ,
3636 surface,
@@ -165,6 +165,7 @@ pub enum Message {
165165 #[ cfg( feature = "wayland" ) ]
166166 PanelConfig ( CosmicPanelConfig ) ,
167167 SearchActivate ,
168+ SearchActivateWith ( String ) ,
168169 SearchChanged ( String ) ,
169170 SearchClear ,
170171 SearchSubmit ,
@@ -305,8 +306,7 @@ impl cosmic::Application for SettingsApp {
305306 daytime,
306307 ) ) )
307308 } ) ,
308- #[ cfg( feature = "wayland" ) ]
309- event:: listen_with( |event, _, _id| match event {
309+ event:: listen_with( |event, status, _id| match event {
310310 #[ cfg( feature = "wayland" ) ]
311311 iced:: Event :: PlatformSpecific ( PlatformSpecific :: Wayland (
312312 wayland:: Event :: Output ( wayland:: OutputEvent :: Created ( Some ( info) ) , o) ,
@@ -315,6 +315,13 @@ impl cosmic::Application for SettingsApp {
315315 iced:: Event :: PlatformSpecific ( PlatformSpecific :: Wayland (
316316 wayland:: Event :: Output ( wayland:: OutputEvent :: Removed , o) ,
317317 ) ) => Some ( Message :: OutputRemoved ( o) ) ,
318+ iced:: Event :: Keyboard ( keyboard:: Event :: KeyPressed {
319+ key: keyboard:: Key :: Character ( c) ,
320+ modifiers: m,
321+ ..
322+ } ) if status == event:: Status :: Ignored && !m. control( ) && !m. alt( ) && !m. logo( ) => {
323+ Some ( Message :: SearchActivateWith ( c. to_string( ) ) )
324+ }
318325 _ => None ,
319326 } ) ,
320327 #[ cfg( feature = "wayland" ) ]
@@ -362,9 +369,10 @@ impl cosmic::Application for SettingsApp {
362369 return self . search_changed ( phrase) ;
363370 }
364371
365- Message :: SearchActivate => {
366- self . search_active = true ;
367- return cosmic:: widget:: text_input:: focus ( self . search_id . clone ( ) ) ;
372+ Message :: SearchActivate => return self . on_search ( ) ,
373+
374+ Message :: SearchActivateWith ( phrase) => {
375+ return self . on_search ( ) . chain ( self . search_changed ( phrase) ) ;
368376 }
369377
370378 Message :: SearchClear => {
0 commit comments