halo/services
Values
audio
const audio: AudioThe default output device's volume and mute; follows device switches.
battery
const battery: BatteryThe internal battery, from power-source notifications.
clock
const clock: ClockThe current time as reactive strings.
drag
const drag: DragFile drags in progress, from mouse events and the drag pasteboard's type (its contents are never read).
frontApp
const frontApp: FrontAppThe frontmost app, updated as you switch apps.
network
const network: NetworkNetwork reachability and interface type. No Wi-Fi name: that needs a Location permission halo can't ask for.
power
const power: PowerLow Power Mode and the thermal state, updated as they change.
session
const session: SessionScreen lock, display sleep and wake from system sleep.
system
const system: SystemCPU and memory usage.
Interfaces
Audio
interface AudioThe default output device. Every value is reactive.
| Property | Type | Description |
|---|---|---|
device() | (): string | undefined | The output device's name. |
muted() | (): boolean | undefined | |
setMuted() | (muted: boolean): boolean | |
setVolume() | (volume: number): boolean | Sets the volume (0–1); false when the device can't. |
toggleMuted() | (): boolean | |
volume() | (): number | undefined | 0–1, or undefined when the device has no software volume (many HDMI/DisplayPort outputs). |
Battery
interface BatteryThe internal battery. Every value is reactive.
| Property | Type | Description |
|---|---|---|
charging() | (): boolean | undefined | |
minutesRemaining() | (): number | undefined | Minutes to empty (or to full while charging), when macOS has an estimate. |
percent() | (): number | undefined | 0–100. |
present() | (): boolean | Whether this Mac has a battery; the rest stays undefined when it doesn't. |
source() | (): "ac" | "battery" | undefined | What powers the Mac now. |
Clock
interface ClockThe current time as reactive strings.
| Property | Type | Description |
|---|---|---|
format() | (pattern: string): Accessor<string> | The time formatted with a Unicode date pattern ("HH:mm", "EEE d MMM"). Updates every minute, or every
second when the pattern shows seconds; stops when nothing reads it. |
Drag
interface DragFile drags anywhere on screen. Every value is reactive.
| Property | Type | Description |
|---|---|---|
active() | (): boolean | Files are being dragged right now, from Finder or any app. Show a drop zone while it's true; it stays true a moment after the button goes up, until the drop has landed. |
outgoing() | (): boolean | The drag started in a halo widget (draggable): don't open a drop zone for files leaving it. |
FrontApp
interface FrontAppThe frontmost app. Every value is reactive.
| Property | Type | Description |
|---|---|---|
bundleId() | (): string | undefined | Works with <Image app={…}> for its icon. |
name() | (): string | undefined | |
pid() | (): number | undefined |
Network
interface NetworkNetwork reachability. Every value is reactive.
| Property | Type | Description |
|---|---|---|
connected() | (): boolean | undefined | |
constrained() | (): boolean | undefined | Low Data Mode is on. |
expensive() | (): boolean | undefined | Metered, e.g. a phone hotspot. |
type() | (): "other" | "none" | "wifi" | "ethernet" | "cellular" | undefined | The interface in use; "none" when offline. |
Power
interface PowerPower state beyond the battery. Every value is reactive.
| Property | Type | Description |
|---|---|---|
lowPowerMode() | (): boolean | undefined | Low Power Mode is on. |
thermal() | (): "nominal" | "fair" | "serious" | "critical" | undefined | How hot the Mac runs; anything above "nominal" means macOS is throttling. |
Session
interface SessionThe login session. Every value is reactive.
| Property | Type | Description |
|---|---|---|
displaysAsleep() | (): boolean | undefined | The displays are asleep. |
lastWake() | (): number | undefined | When the Mac last woke from sleep (ms since epoch), since the service started. Changes on every wake. |
locked() | (): boolean | undefined | The screen is locked. Uses undocumented macOS signals: may stay undefined on future versions. |
System
interface SystemCPU and memory, sampled every intervalMs (default 2000) while something reads them.
| Property | Type | Description |
|---|---|---|
cpu() | (intervalMs?: number): number | undefined | Busy share of all cores since the previous sample, 0–1. |
memory() | (intervalMs?: number): number | undefined | Used share of physical memory (active + wired + compressed), 0–1. |
memoryTotal() | (): number | undefined | Physical memory in bytes. |
memoryUsed() | (intervalMs?: number): number | undefined | Used memory in bytes. |