Merge pull request #195 from pop-os/fix-wmclass
cosmic-toplevel: Also match by StartupWMClass
This commit is contained in:
commit
b1f6002ab1
2 changed files with 17 additions and 12 deletions
|
|
@ -16,7 +16,7 @@ use pop_launcher::{
|
||||||
Request,
|
Request,
|
||||||
};
|
};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::{ffi::OsString, fs, path::PathBuf};
|
use std::{fs, path::PathBuf};
|
||||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||||
|
|
||||||
use self::toplevel_handler::{toplevel_handler, ToplevelAction, ToplevelEvent};
|
use self::toplevel_handler::{toplevel_handler, ToplevelAction, ToplevelEvent};
|
||||||
|
|
@ -170,18 +170,18 @@ impl<W: AsyncWrite + Unpin> App<W> {
|
||||||
let mut icon_name = Cow::Borrowed("application-x-executable");
|
let mut icon_name = Cow::Borrowed("application-x-executable");
|
||||||
|
|
||||||
for (_, path) in &self.desktop_entries {
|
for (_, path) in &self.desktop_entries {
|
||||||
if let Some(name) = path.file_stem() {
|
if let Ok(data) = fs::read_to_string(&path) {
|
||||||
let app_id: OsString = item.1.app_id.clone().into();
|
if let Ok(entry) = fde::DesktopEntry::decode(&path, &data) {
|
||||||
if app_id == name {
|
if item.1.app_id == entry.appid
|
||||||
if let Ok(data) = fs::read_to_string(path) {
|
|| entry
|
||||||
if let Ok(entry) = fde::DesktopEntry::decode(path, &data) {
|
.startup_wm_class()
|
||||||
if let Some(icon) = entry.icon() {
|
.is_some_and(|class| class == item.1.app_id)
|
||||||
icon_name = Cow::Owned(icon.to_owned());
|
{
|
||||||
}
|
if let Some(icon) = entry.icon() {
|
||||||
|
icon_name = Cow::Owned(icon.to_owned());
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,12 @@ impl<W: AsyncWrite + Unpin> App<W> {
|
||||||
keywords: entry.keywords().map(|keywords| {
|
keywords: entry.keywords().map(|keywords| {
|
||||||
keywords.split(';').map(String::from).collect()
|
keywords.split(';').map(String::from).collect()
|
||||||
}),
|
}),
|
||||||
icon: entry.icon().map(|x| x.to_owned()),
|
icon: Some(
|
||||||
|
entry
|
||||||
|
.icon()
|
||||||
|
.map(|x| x.to_owned())
|
||||||
|
.unwrap_or_else(|| "application-x-executable".to_string()),
|
||||||
|
),
|
||||||
exec: exec.to_owned(),
|
exec: exec.to_owned(),
|
||||||
path: path.clone(),
|
path: path.clone(),
|
||||||
prefers_non_default_gpu: entry.prefers_non_default_gpu(),
|
prefers_non_default_gpu: entry.prefers_non_default_gpu(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue