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 Waiting, with Cancel and Run now; the command line has switchboard pending.
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.
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.
See also #
Triggers, A condition becomes true, A State starts or ends, Run a macro later, Wait until a condition holds