Show main desktop entry name in the desktop action's description

This commit is contained in:
Kirottu
2023-04-11 11:18:05 +03:00
parent 76658aad60
commit f0f520dc20
2 changed files with 5 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ pub fn get_matches(input: RString, entries: &mut Vec<(DesktopEntry, u64)>) -> RV
.map(|(entry, id, _)| Match {
title: entry.name.into(),
icon: ROption::RSome(entry.icon.into()),
description: ROption::RNone,
description: entry.desc.map(|desc| desc.into()).into(),
id: ROption::RSome(id),
})
.collect()

View File

@@ -6,6 +6,7 @@ use crate::Config;
pub struct DesktopEntry {
pub exec: String,
pub name: String,
pub desc: Option<String>,
pub icon: String,
}
@@ -68,6 +69,7 @@ impl DesktopEntry {
exec
},
name: map.get("Name")?.to_string(),
desc: None,
icon: map
.get("Icon")
.unwrap_or(&"application-x-executable")
@@ -108,9 +110,10 @@ impl DesktopEntry {
None => continue,
},
name: match map.get("Name") {
Some(name) => format!("{}: {}", entry.name, name),
Some(name) => name.to_string(),
None => continue,
},
desc: Some(entry.name.clone()),
icon: entry.icon.clone(),
})
}