Browse the docs

System event

Runs the macro when the Mac's appearance, displays, power source, desktop space, mounted drives or audio output change.

The Mac changes: event

Keyboard Maestro: Appearance, Power, Display, Space, Volume, AudioOutputDevice

Details #

Fires when one of six things about the Mac changes. event says which, and value or name narrow it.

eventFires whenvaluename
appearanceThe system switches between light and darklight or dark (the new one)not used
powerThe Mac switches between mains and batteryac or battery (the new one)not used
displayThe set of displays changes: one is plugged in, removed or rearrangedthe number of displays now, as textnot used
spaceThe active desktop (Space) changesnot usednot used
volumeA drive or disk image is mounted or unmountedmounted or unmountedthe volume's name
audioOutputThe default sound output device changesnot usedthe new device's name

value has to equal the event's value (any case). name has to appear inside the event's name (any case), so name: "AirPods" matches "Kyle's AirPods Pro". Leave either empty to match all.

{{triggerValue}} holds the event's value: dark, battery, mounted and so on, or the display count. It is empty for space and audioOutput, which have no value.

Display changes are bundled: macOS reports several changes while the displays rearrange, and Switchboard fires once, shortly after the last. Power only fires when the source really changes, not on every battery reading.

Parameters #

ParameterTypeRequiredValuesWhat it does
eventone ofYesappearance display power space audioOutput volumeRequired. appearance, display, power, space, audioOutput or volume.
nametextOnly fire when the name contains this text. For volume and audioOutput.
valuetextOnly fire for this value. See the table.

Every trigger also takes Limits: a cooldown, the first time each day, every nth time, twice within seconds, a chance, only while you are at the Mac, on one Mac, or in a State. See Limits on any trigger.

Examples #

Say when the Mac goes dark
When
  1. The Mac switches to dark mode
Do
  1. Show “Dark mode is on”
Open in Switchboard to try it
Tell me when a drive is mounted
When
  1. A volume is mounted
Do
  1. Show “Drive {{triggerValue}}”
Open in Switchboard to try it

Gotchas #

  • The volume event is about drives and disk images, not sound volume.

  • display reports how many displays there are now, as text. It does not say which was added.

  • power fires only on a change after Switchboard started. It does not fire at launch for the state you are already in.

  • The appearance event is sent a moment after the change, so the new value is already in place when the macro runs.

  • A trigger with an event that is not in the list never fires.

See also #

Network change, Mac wakes, Switch audio device