fix(panel): case insensitive applet search
This commit is contained in:
parent
45e11578ac
commit
b6fc00972d
1 changed files with 10 additions and 2 deletions
|
|
@ -32,7 +32,7 @@ use std::{borrow::Cow, fmt::Debug, mem, sync::LazyLock};
|
||||||
use crate::{app, pages};
|
use crate::{app, pages};
|
||||||
use cosmic_panel_config::CosmicPanelConfig;
|
use cosmic_panel_config::CosmicPanelConfig;
|
||||||
use cosmic_settings_page::{self as page, Section, section};
|
use cosmic_settings_page::{self as page, Section, section};
|
||||||
use freedesktop_desktop_entry::DesktopEntry;
|
use freedesktop_desktop_entry::{DesktopEntry, unicase::UniCase};
|
||||||
use slotmap::{Key, SlotMap};
|
use slotmap::{Key, SlotMap};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
|
@ -553,7 +553,15 @@ pub struct Applet<'a> {
|
||||||
impl Applet<'_> {
|
impl Applet<'_> {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn matches(&self, query: &str) -> bool {
|
pub fn matches(&self, query: &str) -> bool {
|
||||||
self.name.contains(query) || self.description.contains(query) || self.id.contains(query)
|
let query = query.to_ascii_lowercase();
|
||||||
|
|
||||||
|
[
|
||||||
|
self.name.as_ref(),
|
||||||
|
self.description.as_ref(),
|
||||||
|
self.id.as_ref(),
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.any(|field| field.to_ascii_lowercase().contains(&query))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue