icons: use heuristicLookup
This commit is contained in:
parent
22a88aaa41
commit
daad6e4480
1 changed files with 2 additions and 15 deletions
|
|
@ -103,10 +103,6 @@ Singleton {
|
||||||
"395": "snowing"
|
"395": "snowing"
|
||||||
})
|
})
|
||||||
|
|
||||||
readonly property var desktopEntrySubs: ({
|
|
||||||
"gimp-3.0": "gimp"
|
|
||||||
})
|
|
||||||
|
|
||||||
readonly property var categoryIcons: ({
|
readonly property var categoryIcons: ({
|
||||||
WebBrowser: "web",
|
WebBrowser: "web",
|
||||||
Printing: "print",
|
Printing: "print",
|
||||||
|
|
@ -150,21 +146,12 @@ Singleton {
|
||||||
property string osIcon: ""
|
property string osIcon: ""
|
||||||
property string osName
|
property string osName
|
||||||
|
|
||||||
function getDesktopEntry(name: string): DesktopEntry {
|
|
||||||
name = name.toLowerCase().replace(/ /g, "-");
|
|
||||||
|
|
||||||
if (desktopEntrySubs.hasOwnProperty(name))
|
|
||||||
name = desktopEntrySubs[name];
|
|
||||||
|
|
||||||
return DesktopEntries.applications.values.find(a => a.id.toLowerCase() === name) ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getAppIcon(name: string, fallback: string): string {
|
function getAppIcon(name: string, fallback: string): string {
|
||||||
return Quickshell.iconPath(getDesktopEntry(name)?.icon, fallback);
|
return Quickshell.iconPath(DesktopEntries.heuristicLookup(name)?.icon, fallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAppCategoryIcon(name: string, fallback: string): string {
|
function getAppCategoryIcon(name: string, fallback: string): string {
|
||||||
const categories = getDesktopEntry(name)?.categories;
|
const categories = DesktopEntries.heuristicLookup(name)?.categories;
|
||||||
|
|
||||||
if (categories)
|
if (categories)
|
||||||
for (const [key, value] of Object.entries(categoryIcons))
|
for (const [key, value] of Object.entries(categoryIcons))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue