Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions cosmic-settings/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use cosmic::{
iced::{
self, Length, Subscription,
event::{self, PlatformSpecific},
window,
keyboard, window,
},
prelude::*,
surface,
Expand Down Expand Up @@ -160,6 +160,7 @@ pub enum Message {
#[cfg(feature = "wayland")]
PanelConfig(CosmicPanelConfig),
SearchActivate,
SearchActivateWith(String),
SearchChanged(String),
SearchClear,
SearchSubmit,
Expand Down Expand Up @@ -300,8 +301,7 @@ impl cosmic::Application for SettingsApp {
daytime,
)))
}),
#[cfg(feature = "wayland")]
event::listen_with(|event, _, _id| match event {
event::listen_with(|event, status, _id| match event {
#[cfg(feature = "wayland")]
iced::Event::PlatformSpecific(PlatformSpecific::Wayland(
wayland::Event::Output(wayland::OutputEvent::Created(Some(info)), o),
Expand All @@ -310,6 +310,13 @@ impl cosmic::Application for SettingsApp {
iced::Event::PlatformSpecific(PlatformSpecific::Wayland(
wayland::Event::Output(wayland::OutputEvent::Removed, o),
)) => Some(Message::OutputRemoved(o)),
iced::Event::Keyboard(keyboard::Event::KeyPressed {
key: keyboard::Key::Character(c),
modifiers: m,
..
}) if status == event::Status::Ignored && !m.control() && !m.alt() && !m.logo() => {
Some(Message::SearchActivateWith(c.to_string()))
}
_ => None,
}),
#[cfg(feature = "wayland")]
Expand Down Expand Up @@ -357,9 +364,10 @@ impl cosmic::Application for SettingsApp {
return self.search_changed(phrase);
}

Message::SearchActivate => {
self.search_active = true;
return cosmic::widget::text_input::focus(self.search_id.clone());
Message::SearchActivate => return self.on_search(),

Message::SearchActivateWith(phrase) => {
return self.on_search().chain(self.search_changed(phrase));
}

Message::SearchClear => {
Expand Down