notify

package
v0.15.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

View Source
var ErrNotifierUnavailable = errors.New("notify: no notification binary available (install terminal-notifier or run on macOS with osascript)")

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL