Browse the docs

App commands

Switches between apps, shows or hides them, brings their windows forward, reopens them, or quits the front app and the others.

Switch to app

Keyboard Maestro: SwitchToLastApplication, SwitchToNextApplication, ShowSpecificApp, ShowAll, HideCurrent, HideOthers, HideAll, QuitOthers, QuitSpecificApp, BringWindowsForward

Details #

One step for the app-wide commands that are not "bring this one app to the front" (that is Activate app) and not "quit this named app" (that is Quit app). Pick the command with action:

  • switchLast goes back to the app you used before this one.

  • switchNext goes to the next app in the order they were launched.

  • show unhides the app named in app. It does nothing, and says the app wasn't running, if it isn't running.

  • showAll unhides every hidden app, except those in except.

  • bringForward brings all of an app's windows in front of other apps' windows. Without app it uses the front app.

  • reopen sends the app the "reopen" request, which usually makes it open a new window. Needs app.

  • hideFront hides the front app.

  • hideOthers hides every app except the front app and those in except.

  • hideAll hides every app except those in except, the front app included.

  • quitFront asks the front app to quit. With force it is force-quit.

  • quitOthers asks every app to quit except the front app and those in except.

The output depends on the action: name for the switch, bring-forward and reopen actions, and a list under shown, hidden or quit for the rest. Apps are matched by bundle id or by name.

Parameters #

ParameterTypeRequiredValuesWhat it does
actionone ofYesswitchLast switchNext show showAll bringForward reopen hideFront hideOthers hideAll quitOthers quitFrontRequired. One of switchLast, switchNext, show, showAll, bringForward, reopen, hideFront, hideOthers, hideAll, quitOthers, quitFront. Any other value fails and the message lists them.
apptextThe app's name or bundle id. Needed by show and reopen; optional for bringForward. (bundleId is accepted as another spelling.)
bundleIdtextAnother spelling of app.
exceptlist of textA list of apps (names or bundle ids) to leave alone. Used by showAll, hideOthers, hideAll and quitOthers.
forceyes / noFor quitFront only: force-quit the app instead of asking it politely. quitOthers never forces.

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

Examples #

This switches to the next app and shows a message. A dry run simulates the switch, so nothing moves:

Switch to the next app (really switches when run for real)
Do
  1. Switch to the next app
  2. Show “Switched app” for 2 s
Open in Switchboard to try it

Gotchas #

  • quitFront and quitOthers only ask apps to quit. An app with an unsaved document may show a save sheet or refuse. Only quitFront with force ends an app without asking.

  • switchLast fails with "there is no other app to switch to" when Switchboard has no earlier app to go back to. switchNext fails the same way when only one app is running.

  • hideFront and quitFront fail with "no app is in front" when nothing is frontmost.

  • show and reopen fail without an app.

  • bringForward needs the Accessibility permission, and fails with "isn't running" for an app that is not running.

  • Steps that touch the Mac are simulated in a dry run, so none of these actions really run when you use Try it.

See also #

Activate app, Hide app, Quit app, App or window switcher