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

Support X11 urgency hint on Linux #202

Open maximbaz opened 6 years ago

maximbaz commented 6 years ago

Today it is possible to set urgency hint using the "Custom command" option:

notify-send '%title' '%text' -i '%image'; wmctrl -r 'Thunderbird' -b add,demands_attention

However I'd like to use the GNotifier engine instead of the Custom one, especially because I'm using notify-send anyway.

What I'd like to see is a new option to optionally set the urgency hint in addition to showing the notification.

Thanks!

mkiol commented 6 years ago

Currently, GNotifier tries to set the focus on TB window only when user clicks "Open" action on the notification.

In 8e82b90 I've added new option: "Set focus on Thunderbird window on new notification". When enabled, on Windows it will bring TB window to the foreground but on Linux it should trigger "X11 urgency hint".

Please try the latest dev XPI and let me know if it works for you.

maximbaz commented 6 years ago

Thanks! The behavior is the following on Arch Linux + i3wm:

For me personally 8e82b90 is enough and I'm fine with closing this ticket, I'll be using this functionality because I usually keep Thunderbird on a dedicated workspace. However I'm not sure if the same applies for other people who also want urgency hint 🙂 Up to you.

mkiol commented 6 years ago

You right, it will steal focus. I'm using focus() method that is built into TB API. Probably this method do more than only setting urgency hint...

My (hopefully temporal) workaround is as follows:

Check the latest dev XPI.

maximbaz commented 6 years ago

This works correctly in all cases, thanks! 👍

I think this is actually not a bad workaround at all, I can see how useful it can be. And if choosing between this approach and "Set focus on Thunderbird window on new notification", I would definitely prefer this one, I find the automatically stealing focus a bit too much intrusive. Will you keep that checkbox at all, or will you remove it?

mkiol commented 6 years ago

You right. I've renamed option to "Set urgency hint on new notification" (4f98f83). When enabled, wmctrl -r 'Thunderbird' -b add,demands_attention command will execute on every new notification.

maximbaz commented 6 years ago

This is the best! Just tested, it works perfectly with GNotifier engine 👍