Documentation ¶
Overview ¶
Package notify provides an API to send declarative notifications as well as playing sounds when they're sent.
Index ¶
Constants ¶
const MaxIconSize = 64
MaxIconSize is the maximum size of the notification icon to give to the gio.Icon.
Variables ¶
var PlayNotificationSound = prefs.NewBool(true, prefs.PropMeta{
Name: "Play Notification Sound",
Section: "Application",
Description: "Play a sound every time a notification pops up.",
})
PlayNotificationSound is a preference.
var ShowNotification = prefs.NewBool(true, prefs.PropMeta{
Name: "Show Notifications",
Section: "Application",
Description: "Show a notification for messages that mention the user. " +
"No notifications are triggered if the user is focused on the window",
})
ShowNotification is a preference.
Functions ¶
Types ¶
type Action ¶
type Action struct { ActionID string Argument *glib.Variant }
Action is an action of a notification.
func ActionJSONData ¶
ActionJSONData creates a new Action from the given data.
type ID ¶
type ID string
ID is a type for a notification ID. It exists so convenient hashing functions can exist. If the ID is empty, then GTK will internally generate a new one. There's no way to recall/change the notification then.
type Icon ¶
type Icon interface {
// contains filtered or unexported methods
}
Icon is a type for a notification icon.
type Notification ¶
type Notification struct { ID ID Title string // required Body string // Icon is the notification icon. If it's nil, then the application's icon // is used. Icon Icon // Action is the action to activate if the notification is clicked. Action Action // Priority is the priority of the notification. Priority gio.NotificationPriority // Sound, if true, will ring a sound. If it's an empty string, then no sound // is played. Sound Sound }
Notification is a data structure for a notification. A GNotification object is created from this type.
func (*Notification) Send ¶
func (n *Notification) Send(app *app.Application)
Send sends the notification to the application.