desktopToDarwinBundle: Fix icon selection algorithm

Now, the fallback icon is only used after considering all possible icons
instead of only the first one.
This commit is contained in:
Marco Rebhan 2023-03-25 22:09:57 +01:00
parent d9a07bcd41
commit f78175ad35

View file

@ -54,21 +54,30 @@ convertIconTheme() {
$((iconSize - 2))x$((iconSize - 2))${scaleSuffix}
)
local fallbackIcon=
for iconIndex in "${!candidateIcons[@]}"; do
for maybeSize in "${validSizes[@]}"; do
icon=${candidateIcons[$iconIndex]}
if [[ $icon = */$maybeSize/* ]]; then
if [[ $maybeSize = $exactSize ]]; then
echo "fixed $icon"
return 0
else
echo "threshold $icon"
return 0
fi
elif [[ -a $icon ]]; then
echo "fallback $icon"
elif [[ -a $icon && -z "$fallbackIcon" ]]; then
fallbackIcon="$icon"
fi
return 0
done
done
if [[ -n "$fallbackIcon" ]]; then
echo "fallback $fallbackIcon"
return 0
fi
echo "scalable"
}