Skip to content

Commit

Permalink
added NewDefaultAction helper
Browse files Browse the repository at this point in the history
  • Loading branch information
esiqveland committed Jun 9, 2024
1 parent 267dd7a commit 6f7ebc5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,19 @@ const ExpireTimeoutNever time.Duration = 0

// Action holds key and label for user action buttons.
type Action struct {
Key string
// Key is the identifier for the action, used for signaling back which action was selected
Key string
// Label is the localized string that will be displayed to the user
Label string
}

// NewDefaultAction creates a new default action.
// The default action is usually invoked by clicking on the notification.
// The label can be anything, but implementations are free whether to display it.
func NewDefaultAction(label string) Action {
return Action{Key: "default", Label: label}
}

// SendNotification is provided for convenience.
// Use if you only want to deliver a notification and do not care about actions or events.
func SendNotification(conn *dbus.Conn, note Notification) (uint32, error) {
Expand Down

0 comments on commit 6f7ebc5

Please sign in to comment.