Created
September 26, 2018 13:54
-
-
Save dcordero/c4dce4508b9d5327fb82b0dbcca75102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
xcode_path=$1 | |
# Backup icon | |
cp "${xcode_path}/Contents/Resources/Xcode.icns" "${xcode_path}/Contents/Resources/Xcode-original.icns" | |
# Get version | |
version=`${xcode_path}/Contents/Developer/usr/bin/xcodebuild -version | head -1 | cut -f2 -d' '` | |
# Unpack icon | |
iconutil -c iconset -o /tmp/badge.iconset "${xcode_path}/Contents/Resources/Xcode.icns" | |
# Badge | |
cd /tmp/badge.iconset | |
badge --shield "Xcode-${version}-blue" --no_badge --shield_gravity South --glob "/*.png" | |
# Pack icon | |
iconutil -c icns /tmp/badge.iconset -o ${xcode_path}/Contents/Resources/Xcode.icns | |
# Refresh icon | |
touch ${xcode_path} | |
rm /var/folders/*/*/*/com.apple.dock.iconcache | |
killall Finder Dock | |
# Clean tmp env | |
rm -rf /tmp/badge.iconset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment