Power Menu Custom Action Documentation

REQUIRED — Knowledge of how to program in Bash. is required to create a custom action.

What is a custom action, and what can it do?

A custom action is a script that runs on a specified list of files and can chose to interact with them or perform another action. Some examples of some custom actions are:

Getting started

Create a custom action

You can create a custom action by performing the following steps:

  1. Open Power Menu
  2. Click the ‘Manage Actions’ section in the preferences
  3. Click the + button in the ‘Actions List’ table
  4. Click the ‘Run Custom Script’ option
  5. A new blank custom action will be created

What information is passed to the action?

The action is ran with a array of files are the arguments. You can access the array of files by using the "%@" variable in your script. Or you can access a specific item in the array by using the "$1", "$2", "$3", etc variables. An couple examples of how the bundled scripts interact with this information is:

Copy paths to clipboard

This action reads the array of files using the "%@" variable, then splits each item onto a new line.

function join_by { local IFS="$1"; shift; echo "$*"; }

join_by $'\n' "$@" | pbcopy

New Terminal Window Here

This action reads the first item in the array and opens a new Terminal window at that location.

open -a Terminal "$1"

Does a Power Menu action support output?

Power Menu does not currently support displaying of any output that is produced by an action. This is something that may come in a later version.

Are there anymore examples?

You can view a list of a number of custom scripts that are included in Power Menu by doing the following:

  1. Locate Power Menu.app in Finder
  2. Right Click it
  3. Click the ‘Show Package Contents’ option
  4. Navigate to Contents > Resources > Default Scripts

A list of some of the actions that appear in Power Menu will be listed. Unfortunately not all the actions are listed here since some of the action’s are handled by the app itself.