mkiol / GNotifier

Thunderbird add-on that replaces built-in notifications with the OS native notifications
https://addons.mozilla.org/thunderbird/addon/gnotifier/
GNU General Public License v3.0
164 stars 25 forks source link

[RFC] expose close reason to handlers #100

Closed dffischer closed 8 years ago

dffischer commented 8 years ago

The code herein is far from complete and more of a work in progress. It did not work on my setup, however I hope it can be useful to other window managers, so I leave it here.

In trying to solve #35, I found that libnotify exposes a closed-reason. Hoping this would enable to tell apart a timeout from a click to the notification body, I implemented its passing to the close handlers. Then, I tested this on my GNOME Shell 3.20 and found the following values.

interaction reason
none (timeout) 2
clicked body 2
clicked button 2
clicked ✖ in top right 2
clicked ✖ in notification area
Dismisses all notifications
2
Moved mouse over notification.
Shell seems to interpret this as "seen" and
destroys notification as mouse leaves body
2

Seems to be an extremely meaningful 2...

As GNOME seems to leave me with no chance to tell whether the notification was closed on purpose, I give up on this path and will have to be satisfied with the buttons.

mkiol commented 8 years ago

Thanks for sharing your findings. Maybe it will be useful in the future. Interesting.. I did some tests with Plasma 5. The results (for supported in P5 interactions), are as follow:

interaction reason
none (timeout) 1
clicked body 2
clicked button 3
clicked ✖ in top right 2