Zig API Reference¶
Auto-generated from Zig source files in src/.
These are the internal Zig modules. For C/Swift interop, see the C FFI Reference.
notify.zig¶
Notification urgency level.
Maps to libnotify urgency on Linux (NOTIFY_URGENCY_LOW, _NORMAL,
_CRITICAL). On macOS, the value is accepted but ignored because
display notification has no urgency concept.
Send a desktop notification with the given title, optional body, and urgency.
On macOS: executes osascript -e 'display notification ...'.
On Linux: calls notify_notification_new + notify_notification_show.
Returns error.UnsupportedPlatform on other operating systems.
Initialize the notification backend.
On Linux, calls notify_init to register the application name with
libnotify. Must be called before send. On macOS this is a no-op
because osascript requires no initialization.
Clean up the notification backend.
On Linux, calls notify_uninit to release libnotify resources.
Should be called once on application exit. On macOS this is a no-op.
notify_linux.zig¶
Initialize libnotify with the given application name.
Calls notify_init(app_name) to register the application with the
notification daemon. Must be called exactly once before send.
app_name must be at most 255 bytes.
Returns error.NameTooLong if app_name exceeds the internal buffer,
or error.NotifyInitFailed if notify_init returns failure.
Release libnotify resources.
Calls notify_uninit() if the backend was previously initialized.
Safe to call multiple times; subsequent calls are no-ops.
Send a notification via libnotify.
Creates a NotifyNotification with the given title, optional body,
and urgency level, then calls notify_notification_show.
Title is limited to 511 bytes, body to 2047 bytes. Exceeding these
returns error.TitleTooLong or error.BodyTooLong respectively.
Returns error.NotInitialized if init was not called first.
notify_macos.zig¶
Send a notification via osascript -e 'display notification ...'.
Builds an AppleScript command string with the given title and optional
body, escaping special characters for AppleScript string literals.
Urgency is accepted for API compatibility but ignored -- macOS
display notification has no urgency concept.
The command buffer is 2048 bytes; extremely long title + body combinations may return a write error.
Returns error.SpawnFailed if osascript cannot be launched, or
error.WaitFailed if the child process cannot be waited on.