//go:build darwin package notify import "os/exec" // Notifier uses osascript (Notification Center) on macOS. type notifier struct{} // New returns a macOS notifier using osascript. func New() Notifier { return notifier{} } func (notifier) Notify(title, body string) error { script := "display notification " + quote(body) + " with title " + quote(title) return exec.Command("osascript", "-e", script).Run() } func quote(s string) string { out := `"` for _, r := range s { switch r { case '\\', '"': out += "\\" + string(r) default: out += string(r) } } return out + `"` }