Skip to content

Commit b71f0a6

Browse files
committed
cosmic-toplevel: Also match by StartupWMClass
1 parent 0febac5 commit b71f0a6

File tree

1 file changed

+11
-11
lines changed
  • plugins/src/cosmic_toplevel

1 file changed

+11
-11
lines changed

plugins/src/cosmic_toplevel/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use pop_launcher::{
1616
Request,
1717
};
1818
use std::borrow::Cow;
19-
use std::{ffi::OsString, fs, path::PathBuf};
19+
use std::{fs, path::PathBuf};
2020
use tokio::io::{AsyncWrite, AsyncWriteExt};
2121

2222
use self::toplevel_handler::{toplevel_handler, ToplevelAction, ToplevelEvent};
@@ -170,18 +170,18 @@ impl<W: AsyncWrite + Unpin> App<W> {
170170
let mut icon_name = Cow::Borrowed("application-x-executable");
171171

172172
for (_, path) in &self.desktop_entries {
173-
if let Some(name) = path.file_stem() {
174-
let app_id: OsString = item.1.app_id.clone().into();
175-
if app_id == name {
176-
if let Ok(data) = fs::read_to_string(path) {
177-
if let Ok(entry) = fde::DesktopEntry::decode(path, &data) {
178-
if let Some(icon) = entry.icon() {
179-
icon_name = Cow::Owned(icon.to_owned());
180-
}
173+
if let Ok(data) = fs::read_to_string(&path) {
174+
if let Ok(entry) = fde::DesktopEntry::decode(&path, &data) {
175+
if item.1.app_id == entry.appid
176+
|| entry
177+
.startup_wm_class()
178+
.is_some_and(|class| class == item.1.app_id)
179+
{
180+
if let Some(icon) = entry.icon() {
181+
icon_name = Cow::Owned(icon.to_owned());
181182
}
183+
break;
182184
}
183-
184-
break;
185185
}
186186
}
187187
}

0 commit comments

Comments
 (0)