Triggers that watch: becomes true, States, waiting runs
Turn any condition into a trigger, name situations as States, scope groups to them, and park runs that wait for a time or a condition.
Triggers that watch #
Switchboard can answer "is this true right now?" for the front app, a window title, the network, the battery, a file, an element on screen, a variable, a script and more. You use those in Only if. This guide is about the other half: watching them, so a change is the trigger.
When something becomes true #
Add the trigger A condition becomes true: pick a condition, then choose to hear when it becomes true, stops being true, or either. "When on battery and below 20%" and "When Zoom stops running" are one trigger each.
It only reacts to a change. Opening Switchboard, or editing a macro, never runs anything because something was already true. A change has to last two seconds (the hold) before it counts, and the same edge rests for ten seconds (the cooldown) afterwards, so a flapping Wi-Fi does not run the macro in a burst.
To react to a value instead of a yes or no, use A value changes: it takes an expression and tells the macro before and after.
States #
A State is a name for a situation, with the conditions that make it up: Deep work = Xcode in front and Zoom not running. States live in the sidebar under Library. Each has a symbol, All or Any of its conditions, and a hold.
Switchboard keeps every State current. You can use one four ways:
as a trigger, A State starts or ends: run a macro when it is entered or left;
as a condition, State is on: only run while it is on, or while it is not;
as a value,
{{state.deepwork}}or state();as a scope for a group: choose While a State is on in the group's inspector. The group's hotkeys work only while the State is on, and fall through to the app otherwise. They are never swallowed outside it.
The menu bar lists the States with a dot. A State's menu can force it on or off until its conditions next change its answer, or for 30 minutes, an hour or two hours, which covers "I am in Deep work even though Xcode is not in front". Pause watching stops reading its conditions.
When a hotkey did not run because its group's State was off, Activity says so.
Runs that wait #
Run a macro later parks a run of another macro until a time, or until a condition has been true for a moment, and returns at once. "Run Back up when I am home and on power, but not after Friday." Parked runs survive a restart. Activity shows them under Upcoming, with Run Now, Change Time… and Skip; the command line has switchboard pending. Run Later (⌃⌘R) parks one by hand: see Run a macro later.
Times read the way you'd say them: in 20m, 21:30, tomorrow 9, fri 5pm, next monday. A run fires once, never twice, and if the Mac was asleep or Switchboard wasn't running at the time, it runs when it can and says how late it was ("ran 2 h 10 min late: the Mac was asleep"), or is skipped if you set If late to skip.
Give a run a key and scheduling it again replaces it instead of adding another. That makes a timer out of two blocks: "Save draft 5 s after the last edit" pushes the save back on every edit, and Cancel a scheduled run or scheduled("key") cancel or read it.
Wait until a condition holds is the in-macro version: the macro stops until a condition holds, with a timeout, and carries on with whether it was met.
For a while #
The most common "later" is undoing something: Do Not Disturb for an hour, Slack muted until 5, the Mac kept awake through a download. A Later block does it in the same macro:
Turn Focus on
Later, after 1 hour: turn Focus off
The run carries on past the block and finishes now. An hour later the block's steps run on their own, as "<Macro> · Later" in Activity, with the variables they mention as they were when the block was reached. Editing the macro in the meantime doesn't change the waiting block. With a key, running the macro again pushes the hour back instead of stacking a second "off".
A block can schedule its own macro again (schedule.run with self), which is a Pomodoro in one macro: show 25:00, and Later, after 25 minutes: chime, ask "another?", and if yes run self.
What it costs #
Most conditions cost nothing while they wait: they are read again only when something that could change them happens. Script and extension conditions, and the few that nothing announces (modifier keys, on-screen elements, files), are polled on a timer you can set with every. If more than 50 conditions are polled, Settings, Health shows a warning with the busiest. AI conditions cannot be watched, because each read would cost money: use them in If.
A macro can also put a button, toggle or slider on the menu bar panel while its Only if holds, and a toggle widget forces a State: see The menu bar panel and macro widgets.
See also #
Triggers, A condition becomes true, A State starts or ends, Run a macro later, Later, Cancel a scheduled run, Wait until a condition holds