Skip to content

Instantly share code, notes, and snippets.

@iangray001
iangray001 / safari-favicons.sh
Last active July 21, 2020 20:16 — forked from dardo82/safari-favicons.sh
Add Touch Icons into Safari's icon cache for sites that have not declared them
#!/bin/sh
# Add Touch Icons to Safari's cache
# Theory of operation is that the domain from the URL of each bookmark is MD5 hashed and used as the filename of a PNG stored in $DIR
# The URL is the domain and subdomain, with no protocol, or path. So for example "app.slack.com" or "discordapp.com".
# Yes this means that multiple sites might collide, and seems to be a weakness of Safari's scheme.
# So this script searches Bookmarks.plist to find the bookmark in question, grabs the URL, hashes it, and copies the new icon named $DIR/${HASH}.png
# Usage: Create PNG files named the same as a bookmarks you want to add. So to add a Touch Icon for a bookmark called Gmail, create a PNG called Gmail.png. Run this script in the directory with the PNGs.
DIR="$HOME/Library/Safari/Touch Icons Cache/Images"