Skip to content

Context and data

A first widget uses this context directly. Component views add ctx.instance and ctx.view; ordinary bar widgets and roots do not have a component instance.

A widget is a folder with an init.luau. omniwmctl shell init <name> creates a starter one:

interval = 60
function render(ctx)
return ui.row{ gap = 6, onClick = ui.popout,
ui.symbol{ name = "clock" },
ui.text{ text = ctx.data.clock } }
end
function popout(ctx)
return ui.text{ text = ctx.data.date, pad = 12 }
end
  • render(ctx) draws the bar slot or configured island root; return ui.box{ w = 0, h = 0 } to draw nothing there.
  • popout(ctx) draws the popout, opened by onClick = ui.popout, shell toggle <widget>, or a drawer.
  • interval (seconds) sets how often timed data such as seconds, cpu and network updates this widget.
  • trigger(ctx, event) runs for omniwmctl shell trigger <widget> <name> [value], the same shell trigger command from onClick or omniwm.run, and host lifecycle events. It runs on each of the widget’s instances. A trigger hook must not run a trigger for its own widget unconditionally, because the event would queue itself again.
  • require("./helpers") and require("@self/helpers") load other files of the widget. require("../lib/panel") loads lib/panel.luau shared by every widget, from the shell folder, else the profile, else default/.
  • ctx.state keeps values between renders; ctx.format formats numbers, percentages and byte sizes for the user’s locale. ctx.format.date(seconds, template, zone) formats a time from a date template such as "jmm" or "EEEdMMM", following the user’s 12- or 24-hour clock, and ctx.format.offset(seconds, zone) gives that zone’s offset from UTC in seconds; zone is an identifier such as "Asia/Tokyo", the local zone when omitted, and an unknown zone gives nil.
  • onClick, onRightClick and onScroll take a command string or a function (ctx, event); event has the button, modifier keys, scroll dx and dy, and a slider’s value.
  • omniwm.run(command) runs an action, and omniwm.log(...) writes to the macOS log under the shell category.
  • spanIslands = true shows the widget on both islands of a bar split around the notch, instead of only its group’s island.

A widget only receives the data it reads, and OmniWM only gathers what some widget reads.

ctx.data.bar.monitorId identifies the current display in both bar and island placements, using the same ID as omniwmctl query displays (for example display:1). Use it to target a display; bar.monitor and island.display are human-readable names and can be shared by multiple displays. bar.style is nil when the current display has no enabled native bar. Display IDs identify connected displays in the current session and can change after reconnecting them.

Use ctx.select("media", "title") when a view needs one field of an object. The view updates when that field changes, so playback-position updates can leave a title-only widget alone. Paths can contain strings and integer array indices, for example ctx.select("bluetooth", "devices", 1, "battery"); a missing path returns nil. Bar and popout dependencies are tracked separately. Reading the same object through ctx.data.media, or selecting a table rather than a scalar, subscribes to the whole object. Event handlers still receive current data and rerender after changing widget state.

render and popout are view construction hooks. Keep service requests and persistent-state mutations in event/lifecycle callbacks; do not start repeating work from a render. Services preserve the current owner when their callbacks run.

Context field Use
data Immutable host facts. Optional feeds can be nil; show an unavailable state before reading nested fields.
select(key, ...) Subscribe to a scalar path rather than all updates of a parent object.
state Mutable, in-memory state for this display and placement; it is not automatically saved.
format Locale-aware formatting functions below.
instance A component’s shared identity, options, state, and provider snapshot; absent outside component callbacks/views.
view Requested component view name, offered dimensions, and value-only props.

Context

export type Context = {
data: Data,
select: (key: string, ...(string | number)) -> any,
state: { [string]: any },
format: Format,
instance: ComponentInstance?,
view: { name: string, w: number?, h: number?, props: any? }?,
}

Fields: data, select, state, format, instance, view

Format

export type Format = {
measure: (text: string, style: { font: Font?, size: number?, weight: Weight?, maxWidth: number?, lines: number?, quarter: boolean? }?) -> (number, number),
number: (value: number, digits: number?) -> string,
percent: (fraction: number, digits: number?) -> string,
bytes: (count: number, style: ("memory" | "file")?) -> string,
date: (seconds: number, template: string, zone: string?) -> string?,
offset: (seconds: number, zone: string?) -> number?,
}

Fields: measure, number, percent, bytes, date, offset

Formatter Behavior
number(value, digits?) Localized number; digits defaults to 0 and is rounded/clamped to 0–6 fractional digits.
percent(fraction, digits?) Localized percentage: pass 0.5 for 50%. Same digits policy as number.
bytes(count, style?) Localized byte count; style defaults to "memory", or use "file". Invalid/out-of-range counts display "—".
date(seconds, template, zone?) Localized date from Unix seconds and a nonempty template such as "jmm" or "EEEdMMM". Zone defaults to local; an unknown zone returns nil.
offset(seconds, zone?) Zone offset from UTC in seconds at that time, including daylight-saving rules; unknown zones return nil.
ui.text{ text = ctx.format.percent((ctx.data.battery or 0) / 100) }
ui.text{ text = ctx.format.bytes(ctx.data.system and ctx.data.system.memory.used or 0) }

TriggerEvent

export type TriggerEvent = {
source: "host"?,
name: string,
value: string?,
}

Fields: source, name, value

ctx.data Contents
clock, date, seconds Localized time and date, and the current time in seconds
island Persistent island geometry and display state; nil for a bar instance
bar, workspaces, workspace, app, title The bar’s workspaces, windows, scratchpads and style; the focused app
cpu, memory, gpu, disk, network, system System statistics and host details, including uptime
networkHistory The last 30 seconds of download and upload speed, and the totals since the Mac started
thermal CPU and GPU temperatures in °C
battery, charging Battery level
power Power source, minutes until empty or full, Low Power Mode, and battery health, cycles, temperature and watts
inputSource The keyboard input source and the enabled ones, each with a short label
privacy Whether any app is using a microphone or a camera
wifi Wi-Fi power, signal, band, channel and security, and the network name once Location access is allowed
bluetooth Bluetooth power and paired devices with their battery levels, once Bluetooth access is allowed
volume, muted, outputs Output volume and the audio outputs
brightness Main display brightness (0–100) and whether the control is available
microphone Default input device volume (0–100) and mute state; either control is absent when unsupported
awake OmniWM’s Prevent Sleep state and its optional Unix expiry time
audioApps Apps with audio and their own volume
media What is playing, with artwork, shuffle and repeat
lyrics Synced lyrics for what is playing, from LRCLIB; the title, artist, album and track length are sent there while the service is allowed and a widget reads lyrics
spectrum 60 bars of what the Mac is playing, from 50 Hz to 10 kHz, and its tempo, about four times a second; needs System Audio Recording, like per-app volume
tempo Just the spectrum tempo in beats per minute, which changes far less often than the bars
calendar Upcoming events and a month to draw, or the selected day’s events and reminders
notifications Retained notifications, app metadata, loading/error state, and native action status
reminders Access state, incomplete reminders, total count and read/action errors
badges Dock badge labels keyed by lowercase bundle ID for apps with managed windows; available to bars, islands and popouts
weather Current conditions with humidity, sunrise and sunset, 24 hours and 7 days
user Your name and account picture
appearance "light" or "dark"
hiddenBar Hidden Bar items, kept current while the Hidden Bar is closed, so a bar widget can show them inline
menuApp App-menu target with process ID, name, and bundle ID; absent if no target is available
components, catalog, settingsSchema Configured instance metadata, installed component catalog, and root option schema; see components and configuration
vars, settings Values from omniwmctl shell set and from [widgets.<name>]

omniwm.d.luau in the shell folder lists every field with its type.

seconds is Unix time in seconds. A root island receives Island geometry and navigation data; ordinary bar placements receive nil for island. Reading a feed requests it; the host does not poll integrations that no widget uses. Library helpers obey the same dependency tracking.

Data

export type Data = {
clock: string,
date: string,
seconds: number,
cpu: number?,
memory: number,
battery: number?,
charging: boolean,
gpu: number?,
disk: number?,
network: { down: number, up: number }?,
volume: number?,
muted: boolean?,
vars: { [string]: string },
weather: Weather?,
workspace: string,
app: string,
bundle: string,
title: string,
workspaces: { Workspace },
bar: Bar,
settings: { [string]: any }?,
hiddenBar: HiddenBar,
system: System?,
outputs: { AudioOutput }?,
audioApps: AudioApps?,
media: Media?,
calendar: Calendar?,
power: Power?,
inputSource: InputSource?,
privacy: { microphone: boolean, camera: boolean }?,
wifi: WiFi?,
bluetooth: Bluetooth?,
user: { name: string, account: string, avatar: string? }?,
thermal: { cpu: number?, gpu: number?, gpuName: string? }?,
networkHistory: { down: { number }, up: { number }, received: number, sent: number }?,
appearance: ("light" | "dark")?,
lyrics: Lyrics?,
spectrum: { access: "unknown" | "granted" | "denied", bars: { number }, bpm: number? }?,
tempo: number?,
island: Island?,
components: { ComponentInfo }?,
catalog: { ComponentCatalogEntry }?,
settingsSchema: { [string]: ComponentOption }?,
reminders: Reminders?,
badges: { [string]: string },
menuApp: { pid: number, name: string, bundle: string }?,
notifications: Notifications?,
awake: Awake?,
microphone: Microphone?,
brightness: Brightness?,
}

Fields: clock, date, seconds, cpu, memory, battery, charging, gpu, disk, network, volume, muted, vars, weather, workspace, app, bundle, title, workspaces, bar, settings, hiddenBar, system, outputs, audioApps, media, calendar, power, inputSource, privacy, wifi, bluetooth, user, thermal, networkHistory, appearance, lyrics, spectrum, tempo, island, components, catalog, settingsSchema, reminders, badges, menuApp, notifications, awake, microphone, brightness

Settings > Network & Permissions > Built-in Services controls Weather and Lyrics. Both default to on and ask no per-host prompt. Weather uses api.open-meteo.com and geocoding-api.open-meteo.com for your configured city or coordinates; Lyrics uses lrclib.net for the playing track. Organization host rules and service blocks apply to both, including redirects. Turning a service off cancels its work and clears its data; Lyrics also clears its cache. Turning it back on re-evaluates current widget demand.

When present, both feeds include access: "ok", "off" or "blocked". A disabled or blocked weather value contains only access, with no temperature, status or forecast arrays. Lyrics keeps status="none" and an empty lines array. Check access before reading measurements or treating missing lyrics as a search result:

local weather = ctx.data.weather
if weather and weather.access ~= "ok" then
return ui.text{ text = weather.access == "off" and "Turned off in Settings" or "Blocked by your organization" }
end
return ui.text{ text = weather and tostring(weather.temp) or "Unavailable" }

WeatherUnavailable

export type WeatherUnavailable = {
access: "off" | "blocked",
}

Fields: access

Lyrics

export type Lyrics = {
access: "ok" | "off" | "blocked",
status: "loading" | "synced" | "none",
lines: { { time: number, text: string } },
}

Fields: access, status, lines

brightness set <0-100>, brightness up and brightness down target the main display. Up/down use 6.25 percentage point steps and clamp at the endpoints. ctx.data.brightness has a numeric value and available. An unavailable display reports {value=0, available=false}; hide brightness controls when unavailable. The getter and setter must both resolve and the getter must return a valid value before a write is attempted.

Brightness refreshes when demand starts or resumes and after a brightness command. External brightness-key changes are not watched by this integration. brightness settings opens Displays settings. Wi-Fi and Bluetooth power switches use the existing wifi settings and bluetooth settings handoffs; their power commands are not enabled without evidence that they work without an administrator prompt. Reading these controls never requests access.

Brightness

export type Brightness = {
value: number,
available: boolean,
}

Fields: value, available

session awake on turns on OmniWM’s Prevent Sleep until session awake off; session awake <minutes> keeps the Mac awake for more than zero and at most 1440 minutes. ctx.data.awake.on is that shared state, the same one the status menu switch shows, and until is the optional Unix expiry of a timed run. A timed run is not saved and expires even when no widget reads it.

microphone set <0-100> and microphone mute control the default input device. The feed listens for device and control changes only while demanded. Unsupported volume or mute controls are nil; no audio is recorded and these commands do not request microphone recording access.

Awake

export type Awake = {
on: boolean,
["until"]: number?,
}

Fields: on, until

Microphone

export type Microphone = {
volume: number?,
muted: boolean?,
}

Fields: volume, muted

calendar day <yyyy-mm-dd> selects a local calendar day. ctx.data.calendar.selectedDay identifies it; events includes that day’s events, including past dates, and reminders independently loads incomplete reminders due that day. Before any selection, the existing upcoming agenda remains available. calendar month today returns to the current month and clears the day selection. Reading calendar or reminder data never requests permission.

ctx.data.reminders is a cached snapshot with access, items, total, truncated and optional error. Access is "notDetermined", "restricted", "denied", "writeOnly" or "full", independently of Calendar access. Reading this data does not request permission.

With full access, items contains at most 100 incomplete reminders. Each Reminder has id, title, list, color, optional due (Unix seconds), allDay, priority and canComplete. Items are ordered by due date, then priority and identifier; undated items come last, and priority 0 means unset. total counts all fetched incomplete reminders; truncated is true when the snapshot contains fewer. Custom views can display any of the supplied items.

Use reminders add <text> to add a reminder to the default writable list with existing Reminders access. A leading time, such as 3:30pm Call mom, is applied to the selected calendar day (today when none is selected); text without a leading time creates an all-day reminder. Adding never requests access implicitly.

Use reminders authorize to request access, reminders settings to open Reminders privacy settings, and reminders complete <id> to complete a selected item. Completion checks current access and whether its list is writable. These are commands, not callback-based service requests: read ctx.data.reminders.error for read or action failures. A successful authorization or completion clears the previous action error; a background refresh does not conceal it. Cached data updates on changes without a reminder polling timer.

omniwm.run(command) sends a host command rather than invoking a shell process. It has no result callback. ui.popout is a host action marker when used as an element handler; it opens/closes the widget’s panel and closes a containing drawer when invoked from its section. Calling it as an ordinary Luau function does not open a native window.

omniwm.run

run: (command: string) -> (),

ui.popout

popout: (ctx: Context) -> (),

onClick, onRightClick and omniwm.run take any omniwmctl command (for example "switch-workspace 2") and these shell commands:

Command Effect
volume up [percent], volume down [percent], volume set <0-100>, volume mute Output volume
brightness set <0-100>, brightness up, brightness down, brightness settings Adjust a supported main display or open Displays settings
microphone set <0-100>, microphone mute Default input volume and mute, when supported
session awake on|off|<minutes> OmniWM’s Prevent Sleep, on until off or for a number of minutes
volume output <id> Switch the output
volume app <bundle> set <0-100>, volume app <bundle> mute, volume app <bundle> reset One app’s volume
volume permission Open the System Audio Recording privacy settings
media play, media pause, media toggle, media next, media previous, media seek <seconds>, media shuffle, media repeat, media open Playback; shuffle turns shuffle on or off and repeat steps through off, one and all, as media.shuffle and media.repeatMode show; when no widget reads media, play, pause and track changes send the media keys
session lock, session sleep, session logout, session restart, session shutdown Lock the screen, sleep, or ask macOS to log out, restart or shut down; macOS shows its usual confirmation for the last three, and asks once for permission to control loginwindow
calendar authorize, calendar settings, calendar open [event], calendar month next|previous|today, calendar day <yyyy-mm-dd> Calendar; settings opens the Calendars privacy settings
reminders authorize, reminders settings, reminders complete <id>, reminders add <text> Request Reminders access, open its privacy settings, or complete a selected writable reminder; failures appear in ctx.data.reminders.error
notifications refresh, notifications settings, notifications open <bundle> Refresh retained notifications, open Full Disk Access settings, or open the source application
notifications dismiss <bundle> <id>, notifications dismiss-all, notifications cancel-dismiss-all Request native dismissal, process the retained snapshot, or stop after the current action
notifications reply <bundle> <id> <hex> Submit a supported native text reply; <hex> is the UTF-8 text encoded as hexadecimal bytes
battery settings, focus settings, screenshot settings Open Battery or Focus settings, or the Screenshot app
input-source select <id>, input-source settings Switch the keyboard input source; open the Keyboard settings
wifi authorize, wifi settings Ask for Location access, or open its privacy settings once asked; open the Wi-Fi settings
bluetooth authorize, bluetooth settings Ask for Bluetooth access, or open its privacy settings once asked; open the Bluetooth settings
shell toggle <name> Open or close a drawer or a widget’s popout, or send the island root a toggle trigger
shell trigger <widget> <name> [value] Call that widget’s trigger(ctx, event) on each of its instances, as omniwmctl shell trigger does
shell menu Open the OmniWM menu at the widget
hidden-bar activate <id> Click a Hidden Bar item
window <action> <id> Any omniwmctl window action on a window

omniwm.log(...) sends diagnostic values to the macOS unified log’s shell category. Use it from a handler or lifecycle hook when diagnosing a widget. omniwm.l10n(key, ...) looks the key up in the style’s strings/<locale>.toml tables, then in OmniWM’s catalog, and formats up to eight arguments. For your own widget text, add the key to your style’s strings/en.toml and put translations beside it.

omniwm.log

log: (...any) -> (),

omniwm.l10n

l10n: (key: string, ...any) -> string,

IDs are host-issued identities. Use a current snapshot for actions; titles and labels are presentation data. BarStyle describes the effective native bar settings, while bar.island indicates which split-bar group is rendering. Hidden Bar menu row IDs are valid only for the displayed native-menu page.

Workspace

export type Workspace = {
id: string,
name: string,
focused: boolean,
visible: boolean,
windows: number,
}

Fields: id, name, focused, visible, windows

Bar

export type Bar = {
monitor: string,
monitorId: string,
island: "all" | "active" | "secondary",
drag: BarDrag?,
badges: "off" | "dot" | "text",
style: BarStyle?,
workspaces: { BarWorkspace },
scratchpads: { BarScratchpad },
}

Fields: monitor, monitorId, island, drag, badges, style, workspaces, scratchpads

BarStyle

export type BarStyle = {
height: number,
labels: boolean,
backgrounds: boolean,
accents: boolean,
inactive: number,
position: "overlappingMenuBar" | "belowMenuBar" | "bottom" | "left" | "right" | "top",
vertical: boolean,
fullWidth: boolean,
notch: string,
notchWidth: number,
level: string,
offsetX: number,
offsetY: number,
autoHide: boolean,
reveal: string,
opacity: number,
transparent: boolean,
solidBlack: boolean,
accentColor: string?,
textColor: string?,
statsButton: boolean,
secureInput: boolean,
keyboardMode: "normal" | "paused" | "prefix" | "window",
previews: boolean,
hideInFullscreen: boolean,
hidesMenuBar: boolean,
}

Fields: height, labels, backgrounds, accents, inactive, position, vertical, fullWidth, notch, notchWidth, level, offsetX, offsetY, autoHide, reveal, opacity, transparent, solidBlack, accentColor, textColor, statsButton, secureInput, keyboardMode, previews, hideInFullscreen, hidesMenuBar

BarWindow

export type BarWindow = {
id: string,
title: string,
focused: boolean,
hidden: boolean,
}

Fields: id, title, focused, hidden

BarItem

export type BarItem = {
id: string,
bundle: string,
name: string,
focused: boolean,
count: number,
hidden: number,
badge: string,
floating: boolean,
windows: { BarWindow },
}

Fields: id, bundle, name, focused, count, hidden, badge, floating, windows

BarWorkspace

export type BarWorkspace = {
id: string,
name: string,
focused: boolean,
windows: { BarItem },
}

Fields: id, name, focused, windows

BarScratchpad

export type BarScratchpad = {
compact: boolean,
id: number,
name: string,
focused: boolean,
revealed: boolean,
visible: boolean,
windows: { BarItem },
}

Fields: compact, id, name, focused, revealed, visible, windows

BarDrag

export type BarDrag = {
sources: { string },
workspaces: { string },
icons: { string },
gaps: { { workspace: string, before: number } },
}

Fields: sources, workspaces, icons, gaps

HiddenBar

export type HiddenBar = {
enabled: boolean,
available: boolean,
rehide: number,
items: { HiddenBarItem },
maxWidth: number,
maxHeight: number,
cell: number,
vertical: boolean,
menu: HiddenBarMenu?,
}

Fields: enabled, available, rehide, items, maxWidth, maxHeight, cell, vertical, menu

HiddenBarItem

export type HiddenBarItem = {
id: string,
name: string,
image: string?,
w: number,
h: number,
}

Fields: id, name, image, w, h

HiddenBarMenu

export type HiddenBarMenu = {
title: string,
backID: string?,
rows: { HiddenBarMenuRow },
}

Fields: title, backID, rows

HiddenBarMenuRow

export type HiddenBarMenuRow = {
id: string,
title: string,
enabled: boolean,
mark: string,
shortcut: string,
submenu: boolean,
separator: boolean,
}

Fields: id, title, enabled, mark, shortcut, submenu, separator

Optional artwork is an image reference. Media elapsed time is sampled with sampledAt and rate; a missing duration/elapsed value must not be replaced with a claimed playback position. Spectrum and per-app volume require System Audio Recording permission; Now Playing does not.

AudioOutput

export type AudioOutput = {
id: string,
name: string,
transport: "builtin" | "usb" | "bluetooth" | "hdmi" | "displayport" | "airplay" | "thunderbolt" | "virtual"
| "aggregate" | "other",
default: boolean,
}

Fields: id, name, transport, default

AudioApp

export type AudioApp = {
id: string,
name: string,
playing: boolean,
volume: number,
muted: boolean,
}

Fields: id, name, playing, volume, muted

AudioApps

export type AudioApps = {
access: "unknown" | "granted" | "denied",
apps: { AudioApp },
}

Fields: access, apps

Media

export type Media = {
title: string,
artist: string,
album: string,
app: string,
bundle: string,
pid: number,
playing: boolean,
duration: number?,
elapsed: number?,
rate: number,
sampledAt: number,
artwork: string?,
shuffle: boolean?,
repeatMode: ("off" | "one" | "all")?,
}

Fields: title, artist, album, app, bundle, pid, playing, duration, elapsed, rate, sampledAt, artwork, shuffle, repeatMode

Read access before rendering protected contents. Timestamps are Unix seconds. Calendar’s end field is accessed as event["end"] because it is a Luau keyword.

Calendar

export type Calendar = {
access: "full" | "writeOnly" | "denied" | "restricted" | "notDetermined",
events: { CalendarEvent },
month: CalendarMonth?,
selectedDay: string?,
reminders: Reminders?,
}

Fields: access, events, month, selectedDay, reminders

CalendarEvent

export type CalendarEvent = {
id: string,
title: string,
calendar: string,
color: string,
start: number,
["end"]: number,
allDay: boolean,
location: string?,
time: string,
day: string,
}

Fields: id, title, calendar, color, start, end, allDay, location, time, day

CalendarMonth

export type CalendarMonth = {
title: string,
year: number,
month: number,
days: number,
offset: number,
today: number,
weekdays: { string },
marked: { number },
}

Fields: title, year, month, days, offset, today, weekdays, marked

Reminders

export type Reminders = {
access: "full" | "writeOnly" | "denied" | "restricted" | "notDetermined",
items: { Reminder },
total: number,
truncated: boolean,
error: string?,
}

Fields: access, items, total, truncated, error

Reminder

export type Reminder = {
id: string,
title: string,
list: string,
color: string,
due: number?,
allDay: boolean,
priority: number,
canComplete: boolean,
}

Fields: id, title, list, color, due, allDay, priority, canComplete

ctx.data.notifications reads retained Notification Center data through a read-only database connection. Full Disk Access is required; reading the feed does not request it. notifications settings opens the Full Disk Access pane. The feed follows database changes while demanded, but native persistence can delay updates by several seconds. membershipComplete reports whether all retained notifications and their identifiers were captured consistently; metadataComplete covers additional text, app and native metadata. complete is true only when both are true. Check these fields alongside state and error before treating the snapshot as authoritative.

The bundled Notifications widget provides Details, Reply, dismissal and Clear All. Custom widgets issue the commands in Actions through omniwm.run; they are shell commands, not additional omniwmctl command paths. Use an item’s current bundle and UUID id, rather than a title or row index. The host derives each item’s actionsSupported flag from the source identifier’s command support. When false, keep the notification visible without Open, Dismiss or Reply, and disable Clear All while it remains visible.

Replies and dismissal require Accessibility. Dismissal and Clear All require membershipComplete and a ready, empty or incomplete state; missing optional details do not prevent clearing consistently identified notifications. Replies still require a complete, ready snapshot. The host revalidates the retained target and the native Notification Center controls. A reply needs exactly one text-input action with unique title and send-button metadata. Unsupported, ambiguous, missing or inaccessible targets report an outcome instead of guessing an action. The database is never edited to dismiss a notification.

notifications reply <bundle> <id> <hex> accepts a nonblank UTF-8 message of at most 4096 bytes, encoded as two hexadecimal characters per byte, without a NUL character. For example, "4f4b" represents "OK":

omniwm.run("notifications reply " .. item.bundle .. " " .. item.id .. " 4f4b")

notifications.action reports the last reply/dismiss target, kind and state. pending means work is in flight; dispatched means the native action was submitted, not that a recipient received the message. dispatchedPanelOpen asks the user to close Notification Center. Other outcomes include denied, unsupported, ambiguous, notFound, historyClosed, unavailable, failed, failedPanelOpen, cancelled and timeout.

While another notification action is in progress, the host rejects a new reply or dismissal without changing notifications.action; its status may still describe the earlier action. Custom widgets should serialize reply and dismissal requests, including while dismissAll.active is true, and match the reported id, bundle and kind to their target before displaying an outcome.

notifications.dismissAll reports batch progress and its latest outcome. Cancelling stops after the current action and does not undo earlier dispatches. dispatched lists notification IDs whose native actions were submitted; the bundled widget hides those rows while waiting for storage to catch up. A later database observation can show notifications that macOS kept, reflected by kept.

Notifications

export type Notifications = {
state: "loading" | "ready" | "empty" | "accessDenied" | "unavailable" | "queryError" | "malformed" | "incomplete",
complete: boolean,
membershipComplete: boolean,
metadataComplete: boolean,
items: { NotificationItem },
apps: { {
bundle: string,
name: string?,
columns: any,
categories: any,
categoryMetadata: any,
delivered: any,
displayed: any,
requests: any,
} },
error: string?,
action: {
id: string,
bundle: string,
kind: "reply" | "dismiss",
state: string,
}?,
dismissAll: {
total: number,
completed: number,
failed: number,
active: boolean,
state: "pending" | "cancelling" | "cancelled" | "completed" | "partial" | "failed",
outcome: string?,
}?,
dispatched: { string },
kept: number,
}

Fields: state, complete, membershipComplete, metadataComplete, items, apps, error, action, dismissAll, dispatched, kept

NotificationItem

export type NotificationItem = {
id: string,
bundle: string,
actionsSupported: boolean,
title: string,
subtitle: string,
body: string,
date: number?,
requestId: string?,
thread: string?,
category: string?,
attachments: { NotificationAttachment },
actions: { NotificationAction },
userInfo: any,
communication: any,
metadata: any,
}

Fields: id, bundle, actionsSupported, title, subtitle, body, date, requestId, thread, category, attachments, actions, userInfo, communication, metadata

NotificationAttachment

export type NotificationAttachment = {
id: string,
type: string,
path: string?,
available: boolean,
image: string?,
metadata: any,
}

Fields: id, type, path, available, image, metadata

NotificationAction

export type NotificationAction = {
id: string,
title: string,
options: number,
textInputButtonTitle: string?,
textInputPlaceholder: string?,
metadata: any,
}

Fields: id, title, options, textInputButtonTitle, textInputPlaceholder, metadata

Weather supplies current conditions, 24 hourly entries, and seven daily entries; status = "stale" marks retained old data. Temperatures follow the configured unit. System and hardware fields can be absent when unavailable; show that state explicitly.

Weather

export type Weather = {
access: "ok",
temp: number,
feels: number?,
high: number?,
low: number?,
rain: number?,
wind: number?,
humidity: number?,
sunrise: number?,
sunset: number?,
code: number,
day: boolean,
unit: string,
condition: string,
symbol: string,
place: string?,
status: "ok" | "stale",
hours: { WeatherHour },
days: { WeatherDay },
} | WeatherUnavailable

Fields: access, temp, feels, high, low, rain, wind, humidity, sunrise, sunset, code, day, unit, condition, symbol, place, status, hours, days

WeatherHour

export type WeatherHour = {
time: number,
code: number,
label: string,
temp: number,
condition: string,
symbol: string,
day: boolean,
rain: number?,
}

Fields: time, code, label, temp, condition, symbol, day, rain

WeatherDay

export type WeatherDay = {
time: number,
code: number,
label: string,
high: number,
low: number,
condition: string,
symbol: string,
rain: number?,
}

Fields: time, code, label, high, low, condition, symbol, rain

System

export type System = {
memory: { used: number, total: number, pressure: ("normal" | "warning" | "critical")? },
disk: { used: number, total: number },
uptime: number,
host: { name: string, chip: string, model: string, os: string },
displays: { SystemDisplay },
}

Fields: memory, disk, uptime, host, displays

SystemDisplay

export type SystemDisplay = {
w: number,
h: number,
hz: number,
}

Fields: w, h, hz

Power

export type Power = {
source: "ac" | "battery" | "ups",
remaining: number?,
full: number?,
charged: boolean,
lowPower: boolean,
cycles: number?,
health: number?,
temperature: number?,
watts: number?,
adapter: number?,
}

Fields: source, remaining, full, charged, lowPower, cycles, health, temperature, watts, adapter

InputSource

export type InputSource = {
id: string,
name: string,
short: string,
sources: { InputSourceEntry },
}

Fields: id, name, short, sources

InputSourceEntry

export type InputSourceEntry = { id: string, name: string, short: string }

Fields: id, name, short

WiFi

export type WiFi = {
power: boolean,
connected: boolean,
ssid: string?,
rssi: number?,
band: string?,
channel: number?,
security: string?,
location: "authorized" | "denied" | "restricted" | "notDetermined",
}

Fields: power, connected, ssid, rssi, band, channel, security, location

Bluetooth

export type Bluetooth = {
power: boolean,
access: "granted" | "denied" | "restricted" | "notDetermined",
devices: { BluetoothDevice },
}

Fields: power, access, devices

BluetoothDevice

export type BluetoothDevice = {
id: string,
name: string,
kind: "headphones" | "keyboard" | "mouse" | "gamepad" | "computer" | "phone" | "other",
connected: boolean,
battery: number?,
left: number?,
right: number?,
case: number?,
}

Fields: id, name, kind, connected, battery, left, right, case

The panel envelope stays fixed while the Luau content expands or collapses. Coordinates begin at its top-left; size and notch dimensions are in points. navigation.windows follows Niri column/row order, then floating windows. column is one-based for Niri, zero otherwise. Titles use cached metadata and can be empty; fall back to name. Use omniwm.run("window focus " .. id) to focus a window.

Island

export type Island = {
display: string,
usableRect: { x: number, y: number, w: number, h: number },
size: { w: number, h: number },
notch: { x: number, w: number, h: number }?,
menuBar: number,
scale: number,
main: boolean,
visible: boolean,
fullscreen: boolean,
focused: boolean,
drag: { active: boolean, types: { "file" | "url" | "text" | "image" } },
navigation: IslandNavigation?,
drawer: string?,
}

Fields: display, usableRect, size, notch, menuBar, scale, main, visible, fullscreen, focused, drag, navigation, drawer

IslandNavigation

export type IslandNavigation = {
workspace: string,
name: string,
layout: "niri" | "dwindle",
focused: string?,
windows: {
{
id: string,
bundle: string,
name: string,
title: string,
column: number,
}
},
}

Fields: workspace, name, layout, focused, windows