feat: type to search
This commit is contained in:
parent
96245a8fd9
commit
a345091d4f
1 changed files with 14 additions and 6 deletions
|
|
@ -30,7 +30,7 @@ use cosmic::{
|
|||
iced::{
|
||||
self, Length, Subscription,
|
||||
event::{self, PlatformSpecific},
|
||||
window,
|
||||
keyboard, window,
|
||||
},
|
||||
prelude::*,
|
||||
surface,
|
||||
|
|
@ -168,6 +168,7 @@ pub enum Message {
|
|||
#[cfg(any(feature = "page-window-management", feature = "page-accessibility"))]
|
||||
CompConfig(Box<CosmicCompConfig>),
|
||||
SearchActivate,
|
||||
SearchActivateWith(String),
|
||||
SearchChanged(String),
|
||||
SearchClear,
|
||||
SearchSubmit,
|
||||
|
|
@ -308,8 +309,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),
|
||||
|
|
@ -318,6 +318,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")]
|
||||
|
|
@ -375,9 +382,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 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue