Power button
The power button on a Space: suspend and resume, or turn off and on.
The power button on a Space: suspend and resume, or turn off and on.
These APIs are part of the Cua Spaces app export for building Spaces UIs. They are source-available under FSL-1.1-MIT and ship for Swift only (import CuaSpacesFFI); the Rust tab shows the cua-spaces-ffi crate they come from. The open source SDK packages for Python, TypeScript and Kotlin do not include them.
app_power_button derives the button for a Space from what its provider supports and any power change in flight (app_creates_is_powering).
app_creates_is_powering#Whether a power action runs for the Space id: its button waits.
func appCreatesIsPowering(state: AppCreatesState, id: String) -> Bool| Parameter | Type | Default |
|---|---|---|
state | AppCreatesState | required |
id | String | required |
Returns bool
AppPendingPower record#| Field | Type | Default | Description |
|---|---|---|---|
id | String | The Space's id. | |
on | bool | Turning it on (else off). | |
started_at / startedAt | i64 | Epoch ms it started. | |
done | bool | The SDK returned: the row keeps saying so until the registry shows the Space on (or off). | |
error | Option<String> | Why it failed: shown inline until the next power action. |
AppPowerButton record#Returned by app_power_button.
| Field | Type | Default | Description |
|---|---|---|---|
symbol | String | SF Symbol (POWER_SYMBOL). | |
help | String | Tooltip and accessibility label: "Suspend", "Resume", "Turn off" or "Turn on"; while it runs, "Suspending…" and the like. | |
turn_on / turnOn | bool | A press turns it on (else off): the shell's SDK call. | |
enabled | bool | It can be pressed (not while an action runs). | |
busy | bool | An action runs: a spinner shows in its place. |
AppSpacePower record#| Field | Type | Default | Description |
|---|---|---|---|
control | AppPowerControl | How it turns off. | |
off | bool | It is off: suspended or stopped as the SDK recorded it, or not answering with no recorded state (a Space one of your machines provides). | |
turning_on / turningOn | Option<bool> | Being turned on (true) or off (false) now. | |
error | Option<String> | Why the last power action failed, until the next one. |
AppPowerControl enum#.suspend
.stop| Variant | Description |
|---|---|
Suspend | Suspended in memory; it resumes where it was. |
Stop | Stopped with its disk kept; it boots again. |
app_power_button#The power button next to Delete, for a Space that turns off and on.
func appPowerButton(space: AppSpace) -> AppPowerButton?| Parameter | Type | Default |
|---|---|---|
space | AppSpace | required |
Returns Option<AppPowerButton>