Skip to content

Set and remove custom icons on macOS files and folders

Notifications You must be signed in to change notification settings

lightningboltemoji/chicon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ch(ange)icon

Set and remove custom icons on macOS files and folders

Screenshot of dock with custom app icons

macosicons.com is a great source for icons! (no affiliation)

Warning ⚠️ I've never written anything in Swift, so expect this to suck

Subcommands

Set (set)

Applies a custom icon to a file or folder. This should work with many different image formats.

chicon set /Applications/kitty.app ~/Desktop/kitty.png

Remove (rm)

Removes a custom icon that's been previously applied.

chicon rm /Applications/kitty.app

Bulk (bulk)

Performs many set operations in parallel based on the contents of a JSON configuration file.

By default, uses the configuration at ~/.config/chicon/chicon.json.

If an image path is not absolute (i.e. doesn't start with /), it's resolved relative to the configuration file's directory. In general, it's recommended to put the images in the same directory as the configuration file.

chicon bulk
chicon bulk /path/to/custom/config.json

Example configuration:

$ cat ~/.config/chicon/chicon.json 
{
  "/Applications/Amazon Chime.app": "Amazon Chime.icns",
  "/Applications/Microsoft Outlook.app": "Microsoft Outlook.icns",
  "/Applications/Obsidian.app": "Obsidian.icns",
  "/Applications/Slack.app": "Slack.png",
  "/Applications/Spotify.app": "Spotify.png",
  "/Applications/Visual Studio Code.app": "Visual Studio Code.icns",
  "/Applications/Zed.app": "Zed.icns",
  "/Applications/kitty.app": "kitty.icns"
}

Building

xcodebuild -scheme chicon -configuration Release -archivePath ./build/Release clean archive && \
cp ./build/Release.xcarchive/Products/usr/local/bin/chicon ./build && \
rm -rf ./build/Release.xcarchive

This will generate a binary @ ./build/chicon.

Motivation

When apps update, the icon reverts, requiring custom icons to be reapplied often. I hadn't found the perfect tool for this job. fileicon is awesome, but setting many icons at once takes a non-negligible amount of time and requires orchestration. I wanted a declaritive solution that made use of .config and applied many icons very quickly.

Credits

This is only possible because of fileicon. This is just a Swift reimplementation of its logic, and there's no way I'd ever have figured out how to implement it without having it as a reference.

About

Set and remove custom icons on macOS files and folders

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages