icon guess: fix steam regex

This commit is contained in:
end-4
2025-07-04 17:20:33 +02:00
parent 8cd0433ab6
commit 83a7581a34
+3 -2
View File
@@ -27,7 +27,7 @@ Singleton {
}) })
property var regexSubstitutions: [ property var regexSubstitutions: [
{ {
"regex": /^steam_app_(\\d+)$/, "regex": /^steam_app_(\d+)$/,
"replace": "steam_icon_$1" "replace": "steam_icon_$1"
}, },
{ {
@@ -72,6 +72,7 @@ Singleton {
} }
function iconExists(iconName) { function iconExists(iconName) {
if (!iconName || iconName.length == 0) return false;
return (Quickshell.iconPath(iconName, true).length > 0) return (Quickshell.iconPath(iconName, true).length > 0)
&& !iconName.includes("image-missing"); && !iconName.includes("image-missing");
} }
@@ -103,7 +104,7 @@ Singleton {
// Guess: normalize to kebab case // Guess: normalize to kebab case
guessStr = str.toLowerCase().replace(/\s+/g, "-"); guessStr = str.toLowerCase().replace(/\s+/g, "-");
if (iconExists(guessStr)) return guessStr; if (iconExists(guessStr)) return guessStr;
// Guess: First fuzze desktop entry match // Guess: First fuzzy desktop entry match
const searchResults = root.fuzzyQuery(str); const searchResults = root.fuzzyQuery(str);
if (searchResults.length > 0) { if (searchResults.length > 0) {
const firstEntry = searchResults[0]; const firstEntry = searchResults[0];