summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
diff options
context:
space:
mode:
authorMarco Rebhan <me@dblsaiko.net>2023-03-25 22:09:57 +0100
committerMarco Rebhan <me@dblsaiko.net>2023-03-29 16:42:57 +0200
commitf78175ad35e0fa7eb5183b756cfa988b783fed77 (patch)
tree92300ab46c6b51bfae3be8fd92810f1fbf3bf225 /pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
parentd9a07bcd41135f2b9653ba934fc5867856196f78 (diff)
downloadnixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.tar
nixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.tar.gz
nixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.tar.bz2
nixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.tar.lz
nixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.tar.xz
nixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.tar.zst
nixpkgs-f78175ad35e0fa7eb5183b756cfa988b783fed77.zip
desktopToDarwinBundle: Fix icon selection algorithm
Now, the fallback icon is only used after considering all possible icons
instead of only the first one.
Diffstat (limited to 'pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh')
-rw-r--r--pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
index f05a8fb5140..e4e7fba8477 100644
--- a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
+++ b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
@@ -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"
     }