From cbda93a514eb2a4153174331cada54564d947451 Mon Sep 17 00:00:00 2001 From: Ryan Brue Date: Sun, 10 Mar 2024 14:02:51 -0500 Subject: [PATCH] fix: lowercase startup_wm_class, name fallbacks --- src/desktop.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/desktop.rs b/src/desktop.rs index f733850..ac7efb6 100644 --- a/src/desktop.rs +++ b/src/desktop.rs @@ -76,9 +76,19 @@ pub fn load_applications_for_app_ids<'a, 'b>( ) -> Vec { let mut app_ids = app_ids.collect::>(); let mut applications = load_applications_filtered(locale, |de| { - if let Some(i) = app_ids + // If appid matches, or startup_wm_class matches... + if let Some(i) = app_ids.iter().position(|id| { + id == &de.appid + || id + .to_lowercase() + .eq(&de.startup_wm_class().unwrap_or_default().to_lowercase()) + }) { + app_ids.remove(i); + true + // Fallback: If the name matches... + } else if let Some(i) = app_ids .iter() - .position(|id| id == &de.appid || id.eq(&de.startup_wm_class().unwrap_or_default())) + .position(|id| id.to_lowercase().eq(&de.name().to_lowercase())) { app_ids.remove(i); true