mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 12:22:09 +00:00
guess icons also by desktop entry search
This commit is contained in:
parent
440438ef33
commit
c36ca265a5
1 changed files with 9 additions and 1 deletions
|
|
@ -63,7 +63,8 @@ Singleton {
|
|||
}
|
||||
|
||||
function iconExists(iconName) {
|
||||
return Quickshell.iconPath(iconName, true).length > 0;
|
||||
return (Quickshell.iconPath(iconName, true).length > 0)
|
||||
&& !iconName.includes("image-missing");
|
||||
}
|
||||
|
||||
function guessIcon(str) {
|
||||
|
|
@ -93,6 +94,13 @@ Singleton {
|
|||
// Guess: normalize to kebab case
|
||||
guessStr = str.toLowerCase().replace(/\s+/g, "-");
|
||||
if (iconExists(guessStr)) return guessStr;
|
||||
// Guess: First fuzze desktop entry match
|
||||
const searchResults = root.fuzzyQuery(str);
|
||||
if (searchResults.length > 0) {
|
||||
const firstEntry = searchResults[0];
|
||||
guessStr = firstEntry.icon
|
||||
if (iconExists(guessStr)) return guessStr;
|
||||
}
|
||||
|
||||
// Give up
|
||||
return str;
|
||||
|
|
|
|||
Loading…
Reference in a new issue