Documentation ¶
Overview ¶
Package notify interfaces with the Destop Notification daemon, as defined by the desktop notifications spec, via the libnotify library.
Note: Instead of linking libnotify, the library is opportunistically loaded at runtime via dlopen(). This is not applied to glib/gdk as those are pulled in by virtue of the application being a Gtk app.
Index ¶
- Constants
- Variables
- func Init(appName string) error
- func Uninit()
- type Notification
- func (n *Notification) ActionChan() chan string
- func (n *Notification) AddAction(action, label string)
- func (n *Notification) Close()
- func (n *Notification) SetImage(pixbuf *gdk.Pixbuf)
- func (n *Notification) SetTimeout(timeout int)
- func (n *Notification) Show()
- func (n *Notification) Update(summary, body string, icon *gdk.Pixbuf)
Constants ¶
const ( // EXPIRES_DEFAULT is the default expiration timeout. EXPIRES_DEFAULT = C.NOTIFY_EXPIRES_DEFAULT // EXPIRES_NEVER is the infinite expiration timeout. EXPIRES_NEVER = C.NOTIFY_EXPIRES_NEVER )
Variables ¶
var ErrNotSupported = errors.New("libnotify not installed or service not running")
ErrNotSupported is the error returned when libnotify is missing or has failed to initialize.
Functions ¶
Types ¶
type Notification ¶
type Notification struct {
// contains filtered or unexported fields
}
Notification is a `NotifyNotification` instance.
func New ¶
func New(summary, body string, icon *gdk.Pixbuf) *Notification
New returns a new Notification.
func (*Notification) ActionChan ¶
func (n *Notification) ActionChan() chan string
ActionChan returns the channel that actions will be written to.
func (*Notification) AddAction ¶
func (n *Notification) AddAction(action, label string)
AddAction adds an action to the notification.
func (*Notification) SetImage ¶
func (n *Notification) SetImage(pixbuf *gdk.Pixbuf)
SetImage sets the notification image to the specified GdkPixbuf.
func (*Notification) SetTimeout ¶
func (n *Notification) SetTimeout(timeout int)
SetTimeout sets the notification timeout to the value specified in milliseconds.