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"
fi
elif [[ -a $icon ]]; then
echo "fallback $icon"
fi
return 0
fi
elif [[ -a $icon && -z "$fallbackIcon" ]]; then
fallbackIcon="$icon"
fi
done
done
if [[ -n "$fallbackIcon" ]]; then
echo "fallback $fallbackIcon"
return 0
fi
echo "scalable"
}