Skip to content

Instantly share code, notes, and snippets.

@brandondrew
Last active May 29, 2024 03:23
Show Gist options
  • Save brandondrew/dd5124cf3b4621b82f3522cb823ece77 to your computer and use it in GitHub Desktop.
Save brandondrew/dd5124cf3b4621b82f3522cb823ece77 to your computer and use it in GitHub Desktop.
Nice Kitty: update the icon for the Kitty terminal app without dragging icons in the Finder (incomplete)
#!/usr/bin/env zsh
(
mkdir -p ${NICE_KITTY_DIRECTORY:=~/tmp/nice_kitty}
cd "$NICE_KITTY_DIRECTORY"
# detect OS and set ICON_TARGET accordingly
case "$(uname)" in
Darwin)
ICON_TARGET="kitty.app.icns"
;;
Linux|*)
ICON_TARGET="kitty.app.png"
;;
esac
# check whether the repo exists and only clone it if it doesn't exist
[ -d kitty-icon ] || git clone git@github.com:DinkDonk/kitty-icon.git
# change to the repo:
cd kitty-icon
# display a menu offering kitty-dark.icns and kitty-light.icns
echo "Choose an icon:"
select icon in kitty-dark.icns kitty-light.icns; do
break
done
cp "$icon" "${KITTY_CONFIG_DIRECTORY:-$HOME/.config/kitty}/${ICON_TARGET}"
case "$(uname)" in
Darwin)
# clear the icon cache & restart the Dock
rm /var/folders/*/*/*/com.apple.dock.iconcache
killall Dock
;;
Linux|*)
echo "As far as I know, there are no additional steps to take on Linux before restarting Kitty."
echo "If you discover an icon cache that must be cleared, please let me know."
echo
;;
esac
echo "Please restart Kitty and enjoy the new icon as soon as you are ready."
)
### TODO ###
# - [ ] Don't change directories; just define paths and use them; remove () subshell
# - [ ] Pull icons from more than one repo
# - [ ] git pull updates
# - [ ] Allow users to keep the icon repos around without defining NICE_KITTY_DIRECTORY
# For example, the presence of ~/.config/nice_kitty could be a secondary location
# Also, the presence of ~/.config/kitty/nice_kitty could be a tertiary location
# - [ ] Allow users to specify the location for saving icons when they run it
# - [ ] Test on Linux
# - [ ] Test on *BSD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment