Custom actions
The fields of a custom action, and how actions are arranged in the menu.
A custom action is an object in the actions list of the config file. It needs a title, and either a command or an executable to run. Everything else is optional.
"actions": [
{
"title": "Convert to WebP",
"icon": "photo",
"menu": "Images",
"command": "cwebp -q 85 {file} -o {dir}/{basename}.webp",
"extensions": ["png", "jpg", "jpeg"],
"shortcut": "ctrl+cmd+w"
}
]Fields
What it runs
Prop
Type
command is what you want most of the time. executable and arguments are for programs that should get the paths exactly as they are, without a shell in between. If an action has both, command wins. Placeholders and environment explains the difference in detail.
When it appears
Prop
Type
Every selected item has to pass the filters. When an action appears has the exact rules and examples.
How it looks and behaves
Prop
Type
See Output, errors and confirmation and Keyboard shortcuts for these.
The menu
Custom actions appear after the built-in action packs, in this order:
- Submenus first. Each distinct
menuname becomes one submenu. Submenus are sorted by the position of their first matching action in your list. Submenus of custom actions always show the ⚡ icon. - Then the actions without a
menu, in the order you listed them.
Actions whose filters don't match the selection are left out, and a submenu with no matching actions disappears.
"actions": [
{ "title": "Optimize", "menu": "Images", "command": "…", "types": ["public.image"] },
{ "title": "Line Count", "command": "wc -l {files}", "output": "show" },
{ "title": "To GIF", "menu": "Video", "command": "…", "types": ["public.movie"] },
{ "title": "To WebP", "menu": "Images", "command": "…", "types": ["public.image"] }
]With a few images selected, the menu shows an Images submenu with Optimize and To WebP, followed by Line Count. Video is left out because none of its actions apply.
Seeing your actions
Settings → Actions → Custom Actions lists every action in the file with its icon and shortcut, and marks the ones with "enabled": false. It doesn't check whether the commands work: for that, run the action.