Skip to content

Latest commit

 

History

History
45 lines (38 loc) · 1.36 KB

README.md

File metadata and controls

45 lines (38 loc) · 1.36 KB

go-notify

go-notify

Package notify provides an implementation of the Freedesktop Notifications Specification using the DBus API.

Examples

Display a Simple Notification

ntf := notify.NewNotification("Test Notification", "Just a test")
if _, err := ntf.Show(); err != nil {
	return
}

Display a Notification with an Icon. Consult the Icon Naming Specification.

ntf := notify.NewNotification("Test Notification", "Just a test")
//ntf.AppIcon = "/usr/share/icons/gnome/scalable/devices/network-wireless-symbolic.svg"
ntf.AppIcon = "network-wireless"
if _, err := ntf.Show(); err != nil {
	return
}

Display a Notification that never Expires

ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.Timeout = notify.ExpiresNever
if _, err := ntf.Show(); err != nil {
	return
}

Play a Sound with the Notification

ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.Hints = make(map[string]interface{})
ntf.Hints[notify.HintSoundFile] = "/usr/share/sounds/freedesktop/stereo/dialog-information.oga"
if _, err := ntf.Show(); err != nil {
	return
}