Add Shortcut Icon to Finder Toolbar

The following procedure can be followed to add a shortcut icon to a Finder toolbar:

  1. Open the Shortcuts app and select a shortcut.
  2. Add the shortcut to the Dock by way of the File or context menu. This will create a shortcut app in the user’s home Applications folder and will add the shortcut to Launchpad.
  3. Optionally, change the icon of the shortcut app and move it to another folder to remove it from Launchpad.
  4. Command drag the shortcut app to the Finder toolbar.
  5. Remove the shortcut from the Dock if desired.

The most likely use of a Finder shortcut icon is to perform actions on selected files. The following shortcut–which merges selected files in a PDF–can be used for testing:

PDF Merge.shortcut (23.5 KB)

I learned of the procedure to add a shortcut icon to a Finder toolbar from the macmostvideo YouTube channel.

1 Like

The following shortcut selects all files and packages in a Finder window that have the same extension as a currently-selected file or package. I wanted this to also work with a currently-selected folder, but, for various reasons, that was not possible.

BTW, every time you run this shortcut in a particular folder, a privacy dialog appears. Permission to access this folder is remembered, but this is still a major annoyance. I researched this issue but couldn’t find a solution.

Select Extension.shortcut (22.9 KB)

I wanted to run a few shortcuts by way of Finder toolbar icons, and they needed to get the folder that is the target of the front Finder window. There’s not an action that does this directly, and I used an AppleScript action instead. The following is a simple example:

Create Folder.shortcut (22.5 KB)

As much on a proof-of-concept basis as for actual use, I wrote two shortcuts that are run by way of icons in the Finder toolbar. The first uses GUI scripting to select the Go > Enclosing Folder menu item. There are some significant restrictions on the use of GUI scripting in shortcuts, but simple stuff like this seems to work well.

Enclosing Folder.shortcut (21.6 KB)

The second shortcut places on the clipboard the path to a selected item or to the target of the front Finder window. The user can specify a POSIX or HPFS path format. The native shortcut dialogs cannot have three buttons, and this shortcut uses the free swiftDialog app instead. The following screenshot only shows a portion of the shortcut.

Get Path.shortcut (23.4 KB)

In the Privacy & Security section of System Settings, I have set permissions in both Accessibility and Full Disk Access for Shortcuts, Shortcuts Events, ShortcutsActions, and System Events. I also had to separately give Accessibility permission to the Enclosing Folder shortcut.

The following shortcut empties the trash, and it works exactly as I want. However, I’d prefer not to use the Run AppleScript actions, but I haven’t found an alternative. Gemini AI says this can be done with a Delete Files action, but I don’t see how this can be made to work on my Sequoia computer. Does anyone know how to do this without the Run AppleScript actions? Thanks!

Empty Trash.shortcut (22.2 KB)

After adding a shortcut to the Finder toolbar, it’s often a good idea to change the icon (or its color) to something that’s easily recognized. There are several ways to do this, but I thought I’d post what works best for me. The following assumes that an icon for the shortcut already exists in the Finder toolbar.

First, open the shortcut in the editor and change the icon. This can be done directly from the shortcut’s context menu, but that didn’t work well for me.

Second, in the Shortcuts app, select Add to Dock from the shortcut’s context menu.

The new icon of the shortcut should immediately be visible in the Finder window.

After doing the above, you may want to remove the shortcut from the Dock and hide the shortcut in Launchpad.

I revised the shortcut noted above. The new shortcut’s basic operation is the same, but it’s better written and commented. The following screenshot shows a portion of the shortcut and the dialog that is displayed.

Get Path.shortcut (24.2 KB)

I was a bit conflicted about error handling in this shortcut. One option was to check if a path could be gotten at the beginning of the shortcut and to report an error if it could not. This would slow matters considerably and is a condition that would arise infrequently, so I instead opted to place on the clipboard the text “Path not available”.