fix(desktop-entries): Filter desktop entries by App ID rather than Name

This change also avoids any entry whose Exec is `false`. This fixes the GNOME Extensions app, which has two entries with the same Name, but differing App ID's. One of these should be ignored by the launcher, and has its Exec as `false`.
This commit is contained in:
Michael Murphy 2021-09-07 20:33:51 +02:00 committed by GitHub
parent bbd513a54f
commit d297fced20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,14 +25,14 @@ struct Item {
impl Hash for Item {
fn hash<H: Hasher>(&self, state: &mut H) {
self.name.hash(state);
self.appid.hash(state);
self.src.hash(state);
}
}
impl PartialEq for Item {
fn eq(&self, other: &Self) -> bool {
self.name == other.name && self.src == other.src
self.appid == other.appid && self.src == other.src
}
}
@ -120,6 +120,10 @@ impl<W: AsyncWrite + Unpin> App<W> {
if let Some((name, exec)) = entry.name(locale).zip(entry.exec()) {
if let Some(exec) = exec.split_ascii_whitespace().next() {
if exec == "false" {
continue;
}
let item = Item {
appid: entry.appid.to_owned(),
name: name.to_string(),