icon guessing: add quickshell's heuristic lookup

This commit is contained in:
end-4 2025-09-13 22:13:43 +02:00
parent 4f0522d913
commit c39901e95d
2 changed files with 5 additions and 3 deletions

View file

@ -21,7 +21,7 @@ DockButton {
property bool appIsActive: appToplevel.toplevels.find(t => (t.activated == true)) !== undefined
property bool isSeparator: appToplevel.appId === "SEPARATOR"
property var desktopEntry: DesktopEntries.byId(appToplevel.appId)
property var desktopEntry: DesktopEntries.heuristicLookup(appToplevel.appId)
enabled: !isSeparator
implicitWidth: isSeparator ? 1 : implicitHeight - topInset - bottomInset

View file

@ -20,8 +20,6 @@ Singleton {
"wps": "wps-office2019-kprometheus",
"wpsoffice": "wps-office2019-kprometheus",
"footclient": "foot",
"zen": "zen-browser",
"brave-browser": "brave-desktop"
})
property var regexSubstitutions: [
{
@ -91,6 +89,10 @@ Singleton {
function guessIcon(str) {
if (!str || str.length == 0) return "image-missing";
// Quickshell's desktop entry lookup
const entry = DesktopEntries.heuristicLookup(str);
if (entry) return entry.icon;
// Normal substitutions
if (substitutions[str]) return substitutions[str];
if (substitutions[str.toLowerCase()]) return substitutions[str.toLowerCase()];