Browse the docs

Press or hold modifiers

Taps, holds or releases modifier keys such as Command, Option, Control, Shift and Fn on their own.

action modifiers

Keyboard Maestro: SimulateModifiers, ApplyModifiersToApplication

Details #

Presses a modifier key without any other key. Use it for a click or drag that needs a key held down, or for apps that react to a bare modifier. For ordinary shortcuts use Press keys.

action says what to do:

  • press (the default) taps the modifiers: down, a 0.05 second pause, up.

  • hold presses them and keeps them down.

  • release lets go of them.

modifiers can be a list, ["cmd", "shift"], or text such as "cmd+shift" or "⌘⇧". The accepted words are cmd / command, opt / option / alt, ctrl / control, shift, fn / function and hyper (Command, Control, Option and Shift together). An empty list does nothing.

The output holds the modifiers that were used.

Parameters #

ParameterTypeRequiredValuesWhat it does
actionone ofpress hold releasepress, hold or release. The default is press. Any other value fails.
apptextBring this app to the front first (it is not launched if it isn't running). Ignored for release.
modifiersany valueThe keys, as a list or as text (see above). An unknown word fails with "isn't a modifier (cmd, opt, ctrl, shift, fn)".

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Tapping Shift alone does nothing visible in most apps, which makes it a safe thing to try. Run for real, it presses the key:

Tap Shift once (really presses the key)
Do
  1. Tap ⇧
  2. Show “Tapped Shift”
Open in Switchboard to try it

Gotchas #

  • Needs Accessibility permission, otherwise the step fails with "Accessibility isn't allowed for Switchboard Engine".

  • A held modifier is let go by itself after 60 seconds. Always pair hold with a release step anyway.

  • While a modifier is held it affects everything you type or click, not only the macro's steps.

  • Steps that touch the Mac are simulated in a dry run.

See also #

Press keys, Hold or release mouse button, Drag mouse