commit 3ef5edabcbb24ca04b26245315f0185cd02834ef
parent 8b4680fcafcd36f7083abd4b3f8c831c27c5dd34
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date: Thu, 16 Jan 2025 20:01:06 +0800
notify: [linux] provide parent notification ID in callback
Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/notify_linux.go b/notify_linux.go
@@ -22,10 +22,6 @@ func setup(cfg Config) error {
cfg.Linux.AppName,
cfg.Linux.AppIcon,
func(id, action string, platformData map[string]dbus.Variant, target, response dbus.Variant, err error) {
- fn, ok := callbacksTake(&callbacks, id)
- if !ok || fn == nil {
- return
- }
data := make(map[string]string)
data["action"] = action
@@ -36,6 +32,11 @@ func setup(cfg Config) error {
data[k] = v.String()
}
+ fn, ok := callbacksTake(&callbacks, id)
+ if !ok || fn == nil {
+ return
+ }
+
fn(err, id, data)
},
)
@@ -87,7 +88,7 @@ func push(n Notification) (err error) {
userData = make(map[string]string)
}
userData["payload"] = n.AppPayload
- n.Callback(err, id, userData)
+ n.Callback(err, n.ID, userData)
})
return nil