From d88d0ba4bc19c35db49e3f1c581e79cf391a28fe Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Tue, 30 Jul 2024 10:49:24 -0400 Subject: [PATCH] fix: compare OnlyShowIn to XDG_CURRENT_DESKTOP --- src/app.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index 0bc4482..0bf13e1 100644 --- a/src/app.rs +++ b/src/app.rs @@ -319,8 +319,17 @@ pub fn menu_control_padding() -> Padding { impl CosmicAppLibrary { pub fn load_apps(&mut self) { let locale = self.locale.as_deref(); + let xdg_current_desktop = std::env::var("XDG_CURRENT_DESKTOP").ok(); self.all_entries = cosmic::desktop::load_applications_filtered(locale, |entry| { - entry.exec().is_some() && !entry.no_display() + entry.exec().is_some() + && !entry.no_display() + && xdg_current_desktop + .as_ref() + .zip(entry.only_show_in()) + .map(|(xdg_current_desktop, only_show_in)| { + only_show_in.contains(xdg_current_desktop) + }) + .unwrap_or(true) }) .into_iter() .map(Arc::new)