halo DocsGitHub

halo/services

Values

audio

const audio: Audio

The default output device's volume and mute; follows device switches.

battery

const battery: Battery

The internal battery, from power-source notifications.

clock

const clock: Clock

The current time as reactive strings.

drag

const drag: Drag

File drags in progress, from mouse events and the drag pasteboard's type (its contents are never read).

frontApp

const frontApp: FrontApp

The frontmost app, updated as you switch apps.

network

const network: Network

Network reachability and interface type. No Wi-Fi name: that needs a Location permission halo can't ask for.

power

const power: Power

Low Power Mode and the thermal state, updated as they change.

session

const session: Session

Screen lock, display sleep and wake from system sleep.

system

const system: System

CPU and memory usage.

Interfaces

Audio

interface Audio

The default output device. Every value is reactive.

PropertyTypeDescription
device()(): string | undefinedThe output device's name.
muted()(): boolean | undefined
setMuted()(muted: boolean): boolean
setVolume()(volume: number): booleanSets the volume (0–1); false when the device can't.
toggleMuted()(): boolean
volume()(): number | undefined0–1, or undefined when the device has no software volume (many HDMI/DisplayPort outputs).

Battery

interface Battery

The internal battery. Every value is reactive.

PropertyTypeDescription
charging()(): boolean | undefined
minutesRemaining()(): number | undefinedMinutes to empty (or to full while charging), when macOS has an estimate.
percent()(): number | undefined0–100.
present()(): booleanWhether this Mac has a battery; the rest stays undefined when it doesn't.
source()(): "ac" | "battery" | undefinedWhat powers the Mac now.

Clock

interface Clock

The current time as reactive strings.

PropertyTypeDescription
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 Drag

File drags anywhere on screen. Every value is reactive.

PropertyTypeDescription
active()(): booleanFiles 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()(): booleanThe drag started in a halo widget (draggable): don't open a drop zone for files leaving it.

FrontApp

interface FrontApp

The frontmost app. Every value is reactive.

PropertyTypeDescription
bundleId()(): string | undefinedWorks with <Image app={…}> for its icon.
name()(): string | undefined
pid()(): number | undefined

Network

interface Network

Network reachability. Every value is reactive.

PropertyTypeDescription
connected()(): boolean | undefined
constrained()(): boolean | undefinedLow Data Mode is on.
expensive()(): boolean | undefinedMetered, e.g. a phone hotspot.
type()(): "other" | "none" | "wifi" | "ethernet" | "cellular" | undefinedThe interface in use; "none" when offline.

Power

interface Power

Power state beyond the battery. Every value is reactive.

PropertyTypeDescription
lowPowerMode()(): boolean | undefinedLow Power Mode is on.
thermal()(): "nominal" | "fair" | "serious" | "critical" | undefinedHow hot the Mac runs; anything above "nominal" means macOS is throttling.

Session

interface Session

The login session. Every value is reactive.

PropertyTypeDescription
displaysAsleep()(): boolean | undefinedThe displays are asleep.
lastWake()(): number | undefinedWhen the Mac last woke from sleep (ms since epoch), since the service started. Changes on every wake.
locked()(): boolean | undefinedThe screen is locked. Uses undocumented macOS signals: may stay undefined on future versions.

System

interface System

CPU and memory, sampled every intervalMs (default 2000) while something reads them.

PropertyTypeDescription
cpu()(intervalMs?: number): number | undefinedBusy share of all cores since the previous sample, 0–1.
memory()(intervalMs?: number): number | undefinedUsed share of physical memory (active + wired + compressed), 0–1.
memoryTotal()(): number | undefinedPhysical memory in bytes.
memoryUsed()(intervalMs?: number): number | undefinedUsed memory in bytes.