Skip to content

Instantly share code, notes, and snippets.

@brandondurham
Created December 10, 2021 21:05
Show Gist options
  • Save brandondurham/fadeabf3364412d4e04ccc3826b0310c to your computer and use it in GitHub Desktop.
Save brandondurham/fadeabf3364412d4e04ccc3826b0310c to your computer and use it in GitHub Desktop.
Add custom icons to several apps at once.
#!/usr/bin/env bash
# You will need to update app names, paths to apps, and the location of the
# custom app icons. Also, each app includes a `has_copied` var, and each one
# should be 1 higher than the previous. Lastly, the conditional on line 32
# should be updated to match the value of the last `has_copied`. That will
# trigger a restart of the Dock to ensure the new icons are picked up.
#
# There is likely a MUCH smarter way to pull this off. I welcome
# recommendations and optimizations!
set -euf -o pipefail
umask 077
has_copied=0
for atom in Atom "Atom Beta"; do
path="/Applications/${atom}.app"
[ -d "${path}" ] && \
cp ~/Dropbox/App\ Icons/Atom/atom.icns "${path}/Contents/Resources/atom.icns" && \
touch "${path}" && \
has_copied=1
done
for vscode in "Visual Studio Code"; do
path="/Applications/${vscode}.app"
[ -d "${path}" ] && \
cp ~/Dropbox/App\ Icons/VS\ Code/Code.icns "${path}/Contents/Resources/Code.icns" && \
touch "${path}" && \
has_copied=2
done
[ ${has_copied} = "2" ] && killall Dock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment