Want to have your own custom app icon in the dock, but it always gets replaced by an app update?
Inspired by the talks to replace Warp.app icon (in multiple issues on GH), I've made a simple tool to automatically replace the icon after the app update.
Using this helpful article by Mayeu one can make a very simple agent watching for changes in the app icon file and replace it back.
The agent article above gives all the necessary background, here I'll just provide the actual script and agent configuration.
Create a script ~/Tools/warp-watcher.sh
:
#!/bin/sh
FILE_ORIG=/Applications/Warp.app/Contents/Resources/Warp.icns
FILE_REPL=
/Tools/classic_1984_mac.icns
ORIG=
REPL=
if ; then
fi
Don't forget to chmod +x ~/Tools/warp-watcher.sh
!
We perform a check for an actual file change in this script, because otherwise fsevents will be signaling file change every time we copy the file over, resulting in an infinite loop, even if the file didn't actually change.
And make a plist file configuring the agent in ~/Library/LaunchAgents/org.myuser.warp-watcher.plist
:
Label
org.myuser.warp-watcher
ProgramArguments
/Users/you/Tools/warp-watcher.sh
WatchPaths
/Applications/Warp.app/Contents/Resources/Warp.icns
We set up watcher to monitor for changes in the Warp's icon file - when it changes, the script will replace the icon back. This usually happens when the app updates itself, so before it launches again, the script will have a chance to fix the icon.
You can adopt it for any other application, just replace the paths in the script and plist file.
Launch the agent using launchctl load ~/Library/LaunchAgents/org.myuser.warp-watcher.plist
and you're done.
PS. You can find some really nice terminal icons here.