Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/TheCreeper/Go-notify
Package notify provides an implementation of the Gnome DBus Notifications Specification.
https://github.com/TheCreeper/Go-notify
dbus desktop-notifications freedesktop freedesktop-notifications gnome go golang libnotify linux linux-desktop notify-send
Last synced: 20 days ago
JSON representation
Package notify provides an implementation of the Gnome DBus Notifications Specification.
- Host: GitHub
- URL: https://github.com/TheCreeper/Go-notify
- Owner: TheCreeper
- License: bsd-2-clause
- Created: 2015-03-01T19:21:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-11T18:09:42.000Z (almost 4 years ago)
- Last Synced: 2024-10-19T11:58:53.478Z (25 days ago)
- Topics: dbus, desktop-notifications, freedesktop, freedesktop-notifications, gnome, go, golang, libnotify, linux, linux-desktop, notify-send
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 69
- Watchers: 2
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-notify
[![PkgGoDev](https://pkg.go.dev/badge/github.com/TheCreeper/go-notify)](https://pkg.go.dev/github.com/TheCreeper/go-notify)
Package notify provides an implementation of the Gnome DBus
[Notifications Specification](https://developer.gnome.org/notification-spec).## Examples
Display a simple notification.
```Go
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](http://standards.freedesktop.org/icon-naming-spec).
```Go
ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.AppIcon = "network-wireless"
if _, err := ntf.Show(); err != nil {
return
}
```Display a notification that never expires.
```Go
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.
```Go
ntf := notify.NewNotification("Test Notification", "Just a test")
ntf.Hints = make(map[string]interface{})
ntf.Hints[notify.HintSoundFile] = "/home/my-username/sound.oga"
if _, err := ntf.Show(); err != nil {
return
}
```