esiqveland / notify

notify is a go dbus implementation for delivering desktop notifications over dbus
BSD 3-Clause "New" or "Revised" License
70 stars 14 forks source link

Notification subscriber #5

Closed pawelma closed 4 years ago

pawelma commented 7 years ago

Hi. Is it possible to add implementation of notification subscriber to your code. I know you already have eventLoop but 'notificationDelivery' event is missing. I'd like to implement listener of all incoming notifications.

esiqveland commented 7 years ago

That should be possible yes. Do you want to get the stream of all notifications sent over DBus, or are you refering to the NotificationClosed signal?

pawelma commented 7 years ago

All of them :). NotificationClosed signal can probably be handled with current eventLoop implementation but I have to react right after notification appear.

esiqveland commented 7 years ago

You can already get the NotificationClosed signal: https://github.com/esiqveland/notify/blob/master/example/main.go#L80

But remember that this signal is only for dismissed notifications, not when they are dismissed by clicking an action button.

pawelma commented 7 years ago

I saw this event handling before when I was playing with your example. But I need react to NotificationSend (or however this event is named) right after signal is send.

It should work like dbus-monitor which produce following output on notify-send test text command:

$ dbus-monitor "interface='org.freedesktop.Notifications'"
...
method call time=1487927837.852070 sender=:1.1011 -> destination=:1.24 serial=7 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
   string "notify-send"
   uint32 0
   string ""
   string "test"
   string "text"
   array [
   ]
   array [
      dict entry(
         string "urgency"
         variant             byte 1
      )
   ]
   int32 -1

...
esiqveland commented 7 years ago

This is something I could add. Please submit a PR if you feel called ;)

esiqveland commented 4 years ago

I see that this could be useful, but it is not part of the Notification spec nor exposed as a signal in the DBus service.

Closing for now.