Skip to content
MacScout

When an action appears

The rules MacScout uses to decide whether a custom action belongs in the menu.

Each time you open a menu or press a shortcut, MacScout checks every custom action against the current selection. An action appears only if all of these hold:

  1. It is enabled. "enabled": false hides it.
  2. Something is selected, or it allows an empty selection. With nothing selected, only actions with "background": true appear, and only when a folder is open. The other rules don't apply in that case.
  3. The selection has the right size. At least minSelection items and at most maxSelection items, where set.
  4. Every selected item matches. One item that doesn't match hides the action for the whole selection.

Matching an item

A folder matches if folders is true. When you don't set folders, it is true for actions without extensions or types, and false for actions with them. A filter for image files shouldn't show up for folders, and doesn't.

A file matches if files isn't false, and:

  • its extension is in extensions, if you set extensions. Write extensions without the dot. "PNG" and "png" both match photo.png.
  • its type is one of the types, or a more specific type of one, if you set types.

extensions and types can be combined. A file then has to pass both.

Types

types takes Uniform Type Identifiers. A file matches a type when its own type is that type or conforms to it, so "public.image" covers JPEG, PNG, HEIC and every other image format. Some useful ones:

IdentifierCovers
public.imageAll images
public.movieAll video files
public.audioAll audio files
com.adobe.pdfPDF documents
public.textAll text, including source code and JSON
public.plain-textPlain text files
public.source-codeSource code files
public.jsonJSON files
public.archiveArchives such as ZIP

To see a file's type and everything it conforms to, run:

mdls -name kMDItemContentType -name kMDItemContentTypeTree "file.heic"

Examples

Images only:

{ "title": "Optimize", "command": "…", "types": ["public.image"] }

Exactly two files, no folders:

{ "title": "Compare", "command": "diff -u {files}", "output": "show", "minSelection": 2, "maxSelection": 2, "folders": false }

Folders only:

{ "title": "Folder Size", "command": "du -sh {files}", "files": false, "folders": true, "output": "show" }

Only on empty space in a folder. background adds the action for an empty selection, and "maxSelection": 0 removes it for any selection:

{ "title": "New README", "command": "…", "background": true, "maxSelection": 0 }

Any selection, and empty space too:

{ "title": "Back Up", "command": "~/bin/backup {files}", "background": true }

The Home view

Home shows your drives and recent files rather than a folder, so there is no open folder there. Actions with "background": true don't appear on its empty space. When you right-click a recent file, {folder} is the folder that contains it. From the Actions menu or a shortcut, {folder} is empty.

On this page