Sub topic 8
Running shortcuts from the menu bar, Dock, Finder and the keyboard
This chapter assumes you can build a multi-step shortcut and that you know what Shortcut Input is. It covers the ways to start a shortcut once it exists. Each trigger passes different input, so the choice affects how the shortcut behaves.
The ways to run a shortcut
A shortcut does not care how it starts. What changes is the input it receives and where you start it from.
| Trigger | Where you set it up | Input the shortcut gets |
|---|---|---|
| Run button in the editor | Shortcut editor toolbar | None, unless you supply it |
| Menu bar | Shortcut Details, "Pin in Menu Bar" | None, or the clipboard if the shortcut asks for it |
| Dock | Right-click the Shortcuts icon | None |
| Quick Action in Finder | Shortcut Details, "Use as Quick Action" | The files or folders you selected |
| Keyboard shortcut | Shortcut Details, "Add Keyboard Shortcut" | None |
| Spotlight or Siri | Type or say the shortcut's name | None |
Run from the menu bar
Open the shortcut, click the Details button (the "i" icon) in the toolbar, and turn on Pin in Menu Bar. A Shortcuts icon appears in the menu bar. Click it and pick the shortcut to run it. This suits shortcuts you run often and that need no input.
Run from the Dock
Right-click the Shortcuts icon in the Dock. The menu lists your recent or favorite shortcuts, and clicking one runs it. You can also drag a shortcut from the Shortcuts window to the Dock, which creates a shortcut icon you can click to run it.
Run from Finder with Quick Actions
A Quick Action is a shortcut that appears in Finder's context menu. In Shortcut Details, enable Use as Quick Action and tick Finder. Then select files in Finder, right-click, and choose the shortcut under Quick Actions. The Finder item may also appear in the preview pane toolbar.
The selected files arrive as Shortcut Input. Set the shortcut's accepted types in Details so it shows up only for content it can handle, for example Images or Folders. Inside the shortcut, refer to the files with the Shortcut Input magic variable.
Run from the keyboard
In Shortcut Details, click Add Keyboard Shortcut and press the key combination you want. Include at least one modifier key, such as Control, Option or Command.
Keep these points in mind:
- Pick a combination that no app already uses. A clash can cause the other app to win.
- The shortcut runs in the background. You see a progress indicator, and output appears only if the shortcut includes a Show Result or notification action.
How the trigger shapes input
The flow below shows how each trigger reaches the same shortcut.
A common error follows from this. If you build a shortcut that uses Shortcut Input and then start it from the menu bar, the input is empty. Handle this case with an If action that tests whether Shortcut Input has any value. When it is empty, use Choose from List or Select File to ask for the content instead.
Choosing a trigger
- Use the menu bar for small utilities you run many times a day.
- Use a Quick Action when the shortcut works on files you select.
- Use a keyboard shortcut when speed matters and no input is needed.
- Use the Dock for shortcuts you want to start from the same place as your apps.
Troubleshooting
If a trigger does nothing, run the shortcut from the editor first to confirm it works. Then check that the trigger is enabled in Details. Rename the shortcut if two shortcuts share a name, because duplicates make Spotlight and the command line ambiguous.
Exercise
You build a shortcut that resizes images using Shortcut Input. It works as a Finder Quick Action but shows an error when started from the menu bar. Why does this happen, and how do you fix it?
Show answer
From the menu bar no files are passed, so Shortcut Input is empty and the resize action has nothing to work on. Fix it by adding an If action that checks whether Shortcut Input has a value. In the Otherwise branch, add a Select File action so the shortcut asks the user for images, then use that result in the resize step.
Exercise
Which trigger would you choose for a shortcut that renames the files you have selected in Finder, and which setting makes it appear only for files?
Show answer
Use a Finder Quick Action. In Shortcut Details, enable Use as Quick Action with Finder ticked, and limit the accepted input types to Files so it shows only when files are selected.