notify

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

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

View Source
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

View Source
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

func Init

func Init(appName string) error

Init initializes the Desktop Notification interface.

func Uninit

func Uninit()

Uninit cleans up the Desktop Notification interface, prior to termination.

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

func (n *Notification) Close()

Close hides the specified nitification.

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.

func (*Notification) Show

func (n *Notification) Show()

Show (re-)displays the notification.

func (*Notification) Update

func (n *Notification) Update(summary, body string, icon *gdk.Pixbuf)

Update updates the notification. Like the libnotify counterpart, Show() must be called to refresh the notification.

Jump to

Keyboard shortcuts

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