@@ -16,7 +16,7 @@ use pop_launcher::{
16
16
Request ,
17
17
} ;
18
18
use std:: borrow:: Cow ;
19
- use std:: { ffi :: OsString , fs, path:: PathBuf } ;
19
+ use std:: { fs, path:: PathBuf } ;
20
20
use tokio:: io:: { AsyncWrite , AsyncWriteExt } ;
21
21
22
22
use self :: toplevel_handler:: { toplevel_handler, ToplevelAction , ToplevelEvent } ;
@@ -170,18 +170,18 @@ impl<W: AsyncWrite + Unpin> App<W> {
170
170
let mut icon_name = Cow :: Borrowed ( "application-x-executable" ) ;
171
171
172
172
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 ( ) ) ;
181
182
}
183
+ break ;
182
184
}
183
-
184
- break ;
185
185
}
186
186
}
187
187
}
0 commit comments