1

My program needs to react to the user not taking any action on a GNotification.

More specificially, a piece of data is written to the database only if the user does not press the "undo" button on the notification sent after the data's creation. My target deployment scenario does have notifications enabled and a real timeout value.

To be precise: Moving the notification "away" / deleting it should also count as such a timeout.

1) Is there a built-in way to 'listen' to notification timeouts?

2) If not, how could I still implement similar behavior?

5-to-9
  • 649
  • 8
  • 16

1 Answers1

0

I would use the D-Bus org.freedesktop.Notifications interface. Although it is still a draft specification, it does appear stable. My experience accessing the D-Bus interface using Vala has been that it is easier to use and gives the full feature set of the specification. GNotification doesn't seem to be as feature complete.

From the draft specification you will see there is an expire_timeout argument of the org.freedesktop.Notifications.Notify method. That should fit your time out requirement, although I've not used it personally. There is also a org.freedesktop.Notifications.NotificationClosed signal that will allow your program to be notified when the notification is closed, including because of a time out or if it was dismissed by the user.

This post about the screen lock re-design for GNOME Shell 3.10 might give some indication of what notifications are capable of. The post includes some screenshots of notifications appearing in the lock screen.

AlThomas
  • 4,169
  • 12
  • 22