GNotifier icon indicating copy to clipboard operation
GNotifier copied to clipboard

Support X11 urgency hint on Linux

Open max-baz opened this issue 7 years ago • 6 comments

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!

max-baz avatar Mar 24 '18 13:03 max-baz

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.

mkiol avatar Mar 27 '18 14:03 mkiol

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

  • When I'm currently on a different workspace (virtual desktop) from Thunderbird, the urgency hint is triggered (correct!)
  • When I'm on the same workspace as Thunderbird (e.g. working in a text editor), the urgency hint is not triggered, instead the focus is being stolen by Thunderbird (which I think is not very cool).

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.

max-baz avatar Mar 27 '18 15:03 max-baz

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:

  • In c270272 I've added option to execute custom command together with GNotifier engine. You have to set engine to "GNotifier + Custom command"
  • Now, you can execute "wmctrl -r 'Thunderbird' -b add,demands_attention" and still use GNotifier implementation

Check the latest dev XPI.

mkiol avatar Mar 27 '18 18:03 mkiol

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?

max-baz avatar Mar 27 '18 18:03 max-baz

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.

mkiol avatar Mar 28 '18 20:03 mkiol

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

max-baz avatar Mar 28 '18 20:03 max-baz