Set file icon
Gives a file or folder a custom icon from a picture file.
Set the icon of path to icon
Keyboard Maestro: SetFileIcon
Details #
Sets the Finder icon of path to the picture in icon. Both can use ~ for your home folder and can use variables. Any picture macOS can read works, such as PNG, JPEG or an .icns file.
The step checks both files first. It fails if nothing is at path, if there is no picture at icon, or if macOS cannot read icon as a picture. It has no output.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
icon | text | Yes | The picture to use as the icon. Required. | |
path | text | Yes | The file or folder that gets the icon. Required. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
Replace both paths first, since this really changes the folder's icon:
- Set the icon of “Projects”
- Show “Icon set”
Gotchas #
The step fails with "couldn't set the icon of …; is the file writable?" when macOS refuses, for example for a file you cannot write to.
In a dry run the step is simulated and no icon changes.