app search: adjust substitutions

This commit is contained in:
end-4
2025-05-29 23:50:51 +02:00
parent 8ecf9a2597
commit 363e3327ba
+6 -5
View File
@@ -8,7 +8,7 @@ import Quickshell.Io
/** /**
* - Eases fuzzy searching for applications by name * - Eases fuzzy searching for applications by name
* - Guesses icon name for window class name with normalization, possibly with desktop entry searching later * - Guesses icon name for window class name
*/ */
Singleton { Singleton {
id: root id: root
@@ -17,20 +17,21 @@ Singleton {
property var substitutions: ({ property var substitutions: ({
"code-url-handler": "visual-studio-code", "code-url-handler": "visual-studio-code",
"Code": "visual-studio-code", "Code": "visual-studio-code",
"GitHub Desktop": "github-desktop",
"Minecraft* 1.20.1": "minecraft",
"gnome-tweaks": "org.gnome.tweaks", "gnome-tweaks": "org.gnome.tweaks",
"pavucontrol-qt": "pavucontrol", "pavucontrol-qt": "pavucontrol",
"wps": "wps-office2019-kprometheus", "wps": "wps-office2019-kprometheus",
"wpsoffice": "wps-office2019-kprometheus", "wpsoffice": "wps-office2019-kprometheus",
"footclient": "foot", "footclient": "foot",
"zen": "zen-browser", "zen": "zen-browser",
"": "image-missing"
}) })
property var regexSubstitutions: [ property var regexSubstitutions: [
{ {
"regex": "/^steam_app_(\\d+)$/", "regex": "/^steam_app_(\\d+)$/",
"replace": "steam_icon_$1" "replace": "steam_icon_$1"
},
{
"regex": "Minecraft.*",
"replace": "minecraft"
} }
] ]
@@ -66,7 +67,7 @@ Singleton {
} }
function guessIcon(str) { function guessIcon(str) {
if (!str) return "image-missing"; if (!str || str.length == 0) return "image-missing";
// Normal substitutions // Normal substitutions
if (substitutions[str]) if (substitutions[str])