Quaternion
Quaternion copied to clipboard
Support Matrix notifications configuration
There already is (limited) support for notifications (if it's about letting the user know that he's been mentioned or highlight keywords were used). What is requested here?
Okay, then, this might be two separate issues.
- I don‘t get these notifications on my system. I don’t use KDE but I have a notification daemon, which works with a lot of software via D-Bus. I never had a problem with getting notifications.
- The matrix spec defines very specific configurations of when the user wants to get which notifications, quaternion should respect these as good as possible. (And should also have a way to configure them.)
Okay, I got highlight notifications now, after enabling my system tray. But I’d like really much to not use the systemtray but org.freedesktop.Notification
. Newer Qt is supposed to be able to do it. But I don’t know how.
If (it's a big if) Qt 5.7 docs are accurate, QSystemTrayIcon
supports the following two interfaces: (old X11-style) https://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html and (new, DBus-style) https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/ . On the other hand, I see that org.freedesktop.Notifications are used for desktop notifications on X since Qt 5.5. I'm not sure if that mandates having a system tray (hopefully not). I'm afraid that's all I can help with atm.
@KitsuneRal from my experience, going the DBus-style path should cover more scenarios than any other. As with DBus the availability of a target on DBus can be tested for, (as can DBus it's self) you should be able to support it when it's available and fall back to other options if it's not.
That's what I did last time I needed a Notifications mechanism. The other thing to perhaps do is ask @maralorn to capture the relevant dbus messages from some other software on his system so you can confirm it is invoked in the expected way as there may be quirks
@sbts, I cannot subscribe to that since DBus is not (yet?) in fashion on Windows. And making an abstraction layer for notifications across Windows and Linux/MacOS means redoing Qt work. What I'd like to figure out is whether there is a problem in (Qt?) code or it's just a desktop misconfiguration.
So I did some research using Qt sources as well as GNOME, fd.o and Ubuntu web sites. What I found is that though QSystemTrayIcon
actually uses org.freedesktop.Notifications
interface to show messages, it first checks availability of a system tray at org.kde.StatusNotifierWatcher
(not org.freedesktop.StatusNotifier
, which doesn't look quite right in itself). The thing has a fallback, though - it also recognizes an X resource with the name "traywindow" (this is a reference to the older fd.o system-tray spec). I suppose, Unity menu (e.g.) doesn't or didn't respond to such names neither in DBus nor in X.Org, so I now recognize the raison d'être of sni-qt package :-|
Moreover, the QSystemTrayIcon
will only show messages if it is visible. But after the above it's just icing on the cake.
To complicate the matters, system trays get deprecated at least on a couple of well-known desktop platforms, so to rely on system tray existence in order to show notifications is a bad idea in general.
To sum up, while a status tray icon is still a handy feature at least in a couple of other well-known desktop platforms, it might really make sense to hedge the bets with additional code that specifically caters to DBus- and Notifications-enabled but StatusNotifier-less systems. Support of fancy things like MessagingMenu is left aside for now.
So, it was quite a while ago that I looked at this.
What I remember is also, that the Code for using org.freedesktop.Notifications
exists in Qt but is not used for some reason I could not find. If I disable the tray area I don’t get notifications at all.
Just my two cents, going back to work now …
As this is considered an enhancement issue, it is retargeted towards specifically Matrix notifications configuration (nightmarish, even though useful). Problems with desktop notifications will go as separate bug-issues (those struggling are welcome to create new issues).