From 6f7ebc583bbc475fc073ff036872a81db8ea3077 Mon Sep 17 00:00:00 2001 From: Eivind Siqveland Larsen Date: Sun, 9 Jun 2024 15:50:42 +0200 Subject: [PATCH] added NewDefaultAction helper --- notification.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notification.go b/notification.go index 1b114b8..5c53552 100644 --- a/notification.go +++ b/notification.go @@ -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) {