How do I make my tray icon display in Ubuntu Budgie in my PyQt5 app?

Tray icon issues is with he system that you are using, QSystemTrayIcon works with almost every system tray provider and its cross platform too.

We tested that there is nothing wrong with packaging an app that uses QSystemTrayIcon class inside snap as the systray itself do not show icon of qbittorrent normal install. Raise the issue with the budgie desktop env about the issue do not include snaps, tell them there is no icon in system tray for qbittorrent .deb install or what ever way you tried.

2 Likes

An update, QBitTorrent snap does not show icon here on XFCE desktop environment. But shows an entry, hence there is something wrong with QBittorrent App, as all my apps that uses QSystemTray shows tray icon entry here perfectly.

Maybe some tracks to dig over there https://discourse.ubuntubudgie.org/t/hplip-hplip-toolbox-broken-in-budgie/2749/26?u=coeur-noir Qt and (Ubuntu)Budgie are sometimes surprising…

I don’t know the state of the art upstream : https://discuss.getsol.us/ or https://github.com/solus-project/budgie-desktop/issues

Last time I used Ubuntu Budgie, it used indicator-application-service just like Ubuntu MATE, so it can be the same as Desktop notifications denied in Ubuntu MATE.

FYI the issue is being tracked in https://github.com/Arnatious/qbittorrent-snap/issues/2 as well. Long ago I tried seeing if the kde base snaps would help but they were not available for core20 at the time. I’ll try investigating those again.

From what my investigations wrought, the tray icon isn’t getting set. Stderr shows a clear message of

QSystemTrayIcon::setVisible: No Icon set

It might be a dbus issue, but I’m not an expert in Qt or desktop apps so it’s beyond me to solve.

I believe the source of the issue is here

It tries to get the icon from icon theme, but icons in the snap and on the host are different and snap doesn’t mount icons from the host, so this will never work reliably.

I.e. it should be enough to replace #if defined(Q_OS_UNIX) with #if 0 to fix the issue

Or add a check for being in snap if you plan to upstream your change

The changes in https://github.com/Arnatious/qbittorrent-snap/pull/12 have fixed the tray icon issues for both KDE Neon and Ubuntu Gnome.

Adding the KDE framework snap was enough to provide the correct theming and icons. The changes in the linked PR are the equivalent of adding the kde-neon extension, which is amd64 only because the core18 frameworks aren’t published for arm64.

For anyone reading this with a similar problem, snapcraft expand-extensions when using the kde-neon extension with a core20 snap will get you the yaml you need to get it working on amd64 and arm64, just make the changes manually and remove the extension afterwards.

No luck for 32bit users (who are still a decent chunk of my qbittorrent users).