# Keep Mac Awake

Action `cup.and.saucer.fill`

`action.keep_awake`

Prevent your Mac from going to sleep while a workflow runs. The hold stays active until an Allow Sleep node releases it, or until an optional per-node timeout lapses.

The hold uses a public macOS power assertion — no entitlement or special permission is required, and it works inside the sandbox. The assertion is owned by the Watchflows process, so if the app quits or crashes the Mac is free to sleep again automatically (you can never get stuck permanently awake).

The hold prevents idle sleep — the timeout-based sleep that kicks in when you step away. Like every macOS keep-awake tool, it does not override closing the lid (clamshell sleep), choosing Sleep manually, or a critically low battery.

Re-running the same node is idempotent: it releases its own previous hold and applies the current scope and timeout, so exactly one hold is ever active per node.

The node badge reflects the live hold: a timed hold shows a Remaining countdown so you can see exactly how long it has left, while an indefinite hold shows a static Awake badge. While any hold is active, a menu-bar item also appears with a Let it sleep now button — a one-click release from anywhere, even with the main window closed. Deleting the node releases its hold immediately too, so a hold never outlives the node that created it.

## Ports

Direction | Name | Data Type | Description
--- | --- | --- | ---
Input | Input | Any | Incoming payload (passed through, with the hold's status merged in)
Output | Output | Any | Payload with `awake`, `scope`, and `timeoutMinutes` added

## Configuration

Field | Type | Default | Description
--- | --- | --- | ---
scope | Dropdown | `screenOn` | Keep screen on prevents both display and system sleep. System awake, let display sleep keeps the Mac running but allows the screen to turn off.
timeoutMinutes | Number | `0` | Minutes before the hold auto-releases. `0` means indefinite — the hold lasts until an Allow Sleep node runs, the menu-bar Let it sleep now is clicked, or the node is deleted.

## Output Variables

Variable | Type | Description
--- | --- | ---
awake | Boolean | Whether a sleep-prevention hold is active (`false` if the assertion could not be created)
scope | String | The hold's scope (`screenOn` or `systemOnly`)
timeoutMinutes | Number | Minutes until the hold auto-releases (`0` = indefinite)

## Example

Keep the Mac awake while a long export runs, then let it sleep: