Ximi1970 / systray-x

SysTray-X: A system tray extension for Thunderbird. Needs both the addon AND the companion app installed to work. Will not work with TB flatpaks or snaps.
Mozilla Public License 2.0
217 stars 14 forks source link

KDE Plasma system tray auto-hide #24

Closed ghost closed 4 years ago

ghost commented 4 years ago

Applications with system tray support in plasma kde can be hidden if there is no notification. With systray-x this is not happening. It remains visible even if there is no new email. I don't know if this is the way you planned it to work or if it's a bug, so I'm reporting it.

An example is this plasmoid: https://github.com/I-Dream-in-Code/kde-arch-update-plasmoid It checks for archlinux updates and displays an icon in the tray if updates are available, otherwise it will be hidden.

Ximi1970 commented 4 years ago

It is a feature not a bug :smile: but I could make it an option. Will put it on the list.

Ximi1970 commented 4 years ago

I am sorry to say the plasmoid is not the way to go. It is only for plasma/KDE desktop I think. I will stick with my QSystemTrayIcon solution. It is compatible with all desktops.
First thing I tried was to hide and show the tray object but that resulted in losing all signal and slot connections to the object. Bug in Qt or the Kde system tray handling, I do not know yet. Looking now for a way around the problem.

ghost commented 4 years ago

It seems to be something unexplored. I tested the birdtray to see if there was a function like this but it doesn't exist either. I even did some work with that same goal but it didn't look very good (here). The icon is totally hidden, there is no way to open thunderbird through the tray if there is no pending email. Anyway, it's a temporary solution, it can be useful.

Ximi1970 commented 4 years ago

It was also a bug in Qt 5.9. I am now integrating Qt 5.14.2 into the project so all builds will use this version. I am also using a static build so this Qt version does not need to be distributed and the package has no more dependency on system Qt s. Hiding and showing the icon works now fine but I need to test the static build for all systems before I can release it.

The experimental code is in the feature-static branch, no gaurantees it will compile. You need to compile the Qt static in the libs dir first and will take a lot of time on a slower system.

ghost commented 4 years ago

I already have the new dependencies added to my system. I use qt 5.14.2 from the archlinux repository. Do I still need to compile it manually to work for systray-x?

Using this described setup, I was able to build but the icon is still displayed even if there are no notifications.

Ximi1970 commented 4 years ago

You have to use the feature-static branch. Then just run: make Then go to the preferences and select the "Hide icon" option

ghost commented 4 years ago

Yeah, that worked. But the behavior, actually, is the same as I quoted from birdtray. The icon is being completely hidden, and not given a lower priority. So there's no way to open thunderbird through the system tray if there's no new email notification

ghost commented 4 years ago

This would also make it difficult to know if thunderbird is running in the background, as there would be no indicator for this.

Ximi1970 commented 4 years ago

Yes that is a problem with the proposed option. I could give a warning if you select to many hide options. Another option is not to hiide the icon completly but only display an empty space. You still can click the "empty" space to hide/show TB. Then no special version of Qt is needed.

fabianski7 commented 4 years ago

I talked to a plasma kde developer about how to do this and he responded to me with this information

Good question! I know how to do this from QML, but not the C++ side. Maybe ask this at kde-devel@kde.org

Ximi1970 commented 4 years ago

I found a solution for KDE by using KStatusNotifierItem.

You can find it in the feature-notify branch.

Not convinced how stable this is because my plasma taskbar crashed a few times testing things. Still need to checkout how GNOME and other desktops react to this setup.

ghost commented 4 years ago

I compiled the extension and everything is working fine so far.

Ximi1970 commented 4 years ago

Included in 0.4.0