Documentation
¶
Overview ¶
Package notify fires native macOS notifications via terminal-notifier (preferred — supports click actions) or osascript (fallback). On non-Darwin systems and when neither binary is on PATH, Notify returns ErrNotifierUnavailable so callers can degrade gracefully.
Icon caveat: macOS binds the notification's app identity to the bundle that posted it (terminal-notifier itself, or osascript via Script Editor). terminal-notifier's `-appIcon` is honored on some macOS versions but systematically ignored on recent ones — we don't try to ship a custom icon because the only reliable way is to publish a signed AILANG.app bundle that registers as a notification source, which is out of scope here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
ErrNotifierUnavailable is returned when neither terminal-notifier nor osascript is on PATH. Callers should treat this as a non-fatal degradation signal rather than a hard error — log it and continue.
Functions ¶
func Notify ¶
func Notify(n Notification) error
Notify fires a single macOS notification. Returns ErrNotifierUnavailable when neither backend is on PATH; returns the underlying exec error wrapped if the chosen backend fails to run.
Types ¶
type Notification ¶
type Notification struct {
Title string
Subtitle string
Body string
Sound string // default "Glass" if empty
Group string // collapses repeat notifications when shared
URL string // click-action; opens URL when notification is clicked (terminal-notifier only)
}
Notification is a single notification payload. Sound and Group are optional; URL is honored only on the terminal-notifier path (osascript has no click-action equivalent).