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: about 2 months 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 (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-12-11T18:09:42.000Z (about 4 years ago)
- Last Synced: 2024-10-25T05:23:21.197Z (about 2 months 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
- awesome-go - go-notify - Native implementation of the freedesktop notification spec. (Messaging / Search and Analytic Databases)
- zero-alloc-awesome-go - go-notify - Native implementation of the freedesktop notification spec. (Messaging / Search and Analytic Databases)
- awesome-go - go-notify - Package notify provides an implementation of the Gnome DBus Notifications Specification. - ★ 38 (Messaging)
- awesome-go-extra - go-notify - 03-01T19:21:44Z|2020-12-11T18:09:42Z| (Messaging / Advanced Console UIs)
- awesome-go-zh - go-notify
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
}
```