Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System tray icon missing #9518

Closed
ipkpjersi opened this issue Sep 17, 2018 · 46 comments
Closed

System tray icon missing #9518

ipkpjersi opened this issue Sep 17, 2018 · 46 comments
Labels
OS: Linux Issues specific to Linux distributions

Comments

@ipkpjersi
Copy link

Specs:

Ubuntu 16.04 LTS
XFCE 4.12
qBittorrent 4.1.2

What is the problem:

System tray icon missing

What is the expected behavior:

System tray icon should be visible

Steps to reproduce:

Start qBittorrent with option enabled to show qBittorrent in notification area

Notes:

This is a continuation of #6659, it is not fixed yet.

Here are the results of the python script in the last issue:
$ python test.py qbittorrent-tray
/usr/share/icons/Mint-Y/panel/24/qbittorrent-tray.svg
$ python test.py qbittorrent-tray-dark
/usr/share/icons/hicolor/scalable/status/qbittorrent-tray-dark.svg
$ python test.py qbittorrent-tray-light
/usr/share/icons/hicolor/scalable/status/qbittorrent-tray-light.svg

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

What's your setting for Behaviour|Tray icon style, please?

@ipkpjersi
Copy link
Author

My Tray icon style is normal.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

Thanks. If icons are available, this should have something to do with the system tray protocol switch from XEmbed to DBus. Do you have the sni-qt package installed?

@sledgehammer999: we can solve this issue by using the new protocol (well, it is more than 4 years old already, but Qt still uses the old one), but that requires either direct coding DBus calls or using KF5 (and I would strongly support the latter). That would also fix long broken tray notification window (#2934). I have a working implementation. Please let me know if you are interested.

@zeule zeule added the OS: Linux Issues specific to Linux distributions label Sep 17, 2018
@ipkpjersi
Copy link
Author

ipkpjersi commented Sep 17, 2018

I did have sni-qt installed already.

sni-qt is already the newest version (0.2.7+16.04.20170217.1-0ubuntu1).

I really hope this bug can be fixed eventually. This bug still affects me and many others.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

Could you do another test, please? Here is another script (requires PyQt)

#!/usr/bin/env python3

# taken from stackexchange
import sys
from PyQt5 import QtCore, QtGui, QtWidgets

class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
        def __init__(self, icon, parent=None):
                QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
                menu = QtWidgets.QMenu(parent)
                exitAction = menu.addAction("Exit")
                exitAction.triggered.connect(self.exit)
                self.setContextMenu(menu)

        def exit(self):
                QtCore.QCoreApplication.exit()

def main(iconName):
        app = QtWidgets.QApplication(sys.argv)

        w = QtWidgets.QWidget()
        trayIcon = SystemTrayIcon(QtGui.QIcon.fromTheme(iconName), w)

        trayIcon.show()
        sys.exit(app.exec_())

if __name__ == '__main__':
        main(sys.argv[1])

This one creates a tray entry with a given icon and a menu entry for exiting the application. Needs to be invoked with an icon name as the first argument. Please try "qbittorent", "qbittorrent-tray", and "application-exit".

Thank you.

@ipkpjersi
Copy link
Author

ipkpjersi commented Sep 17, 2018

I ran the script with python2 test.py qbittorrent however nothing happens - there are no errors or anything, but there is no tray or console output.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

It has to create a tray entry with a menu and the given icon. The menu should have an action to exit the app. Until activating the exit action the script should continue its execution.

What do you observe in comparison with the description above? Also, try, please, one of the standard icons (like "application-exit").

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

…. but Qt still uses the old one …

I was wrong here. But seems like it passes image data via DBus instead of the icon name.

@ipkpjersi
Copy link
Author

I tried python2 test.py application-exit and it had the same result - no icon in my tray. I have many other tray icons working just fine - Discord, Steam, Dropbox, etc.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

Console output? Error messages? Does the script run as I described above?

@ipkpjersi
Copy link
Author

ipkpjersi commented Sep 17, 2018

There is no output or error messages or tray icons. I run the command, and simply nothing happens. I can tell it is "running" because when I try to run it with python3, it errors out and says something to the effect of could not find module PyQT5.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

Hm, but it should not exit on itself, one has to use tray icon menu or kill it (it does not react on Ctrl+C). Is it what you see?

@ipkpjersi
Copy link
Author

ipkpjersi commented Sep 17, 2018

It does not exist by itself, I would likely have to use the tray icon menu (if I could see the tray icon), or what ends up happening is I just kill it since CRTL+C does not work. So yeah, that is the functionality I see.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

OK, thanks. Is there a placeholder in the tray when the script is running?

@ipkpjersi
Copy link
Author

No, there are no additional icons in the tray at all. It is as if the script were not running other than the fact I cannot use Crtl+C to kill it.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

Thanks. Let me install XFCE on my machine and test. I'll come back to you with my results.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

Unfortunately, my XFCE desktop (4.12 on Gentoo) shows the tray icon. I don't know what to try now. My XFCE desktop somehow differs from yours but I have no idea how to find the different bit...

@ipkpjersi
Copy link
Author

Can you try creating a virtual machine with Ubuntu 16.04 and Xfce 4.12? That seems to be one of the more common configurations for replicating this issue.

@zeule
Copy link
Contributor

zeule commented Sep 17, 2018

OK, I'll try. Installing just the xfce4 package would be enough to reproduce your configuration, or do I need anything else?

@FtK259
Copy link

FtK259 commented Sep 17, 2018

I'm with the same problem here. My specs:
Linux Mint 19 Cinnamon
Cinnamon 3.8.9
qBittorrent 4.1.2

The package sni-qt was not installed in my system, I installed it, reboot, but nothing happens.
I got some errors when trying to open qbit by the terminal:

qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
qt5ct: D-Bus system tray: no
QSystemTrayIcon::setVisible: No Icon set
qt5ct: custom style sheet is disabled
inotify_add_watch("/home/rafael/.config/qt5ct") failed: "No such file or directory"

I'm using the normal tray icon, but even if i change it the problem persist.

@ipkpjersi
Copy link
Author

Sorry for my late reply. I use Ubuntu 16.04 and then install xfce4 and xubuntu-desktop with sudo apt install xfce4 xubuntu-desktop, but, just xfce4 should suffice.

@zywo
Copy link
Contributor

zywo commented Sep 17, 2018

For me, the options are grayed.
Archlinux - Gnome-shell
qBt 4.2.0alpha master branch up to date.

screenshot from 2018-09-17 20-14-31

@thalieht
Copy link
Contributor

@zywo maybe you don't have system tray?

// Disable systray integration if it is not supported by the system
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
m_ui->checkShowSystray->setChecked(false);
m_ui->checkShowSystray->setEnabled(false);
m_ui->labelTrayIconStyle->setVisible(false);
m_ui->comboTrayIcon->setVisible(false);
}

@zywo
Copy link
Contributor

zywo commented Sep 18, 2018

@thalieht this one?

tray

@thalieht
Copy link
Contributor

Probably, but Qt detects your tray isn't available...

@Furyspark
Copy link

I'm using Gnome on Arch Linux, and I didn't get a tray icon either until I installed the packages oxygen and oxygen-icons. Works now, though.

@skaendo
Copy link

skaendo commented Oct 10, 2018

Same issue here. Details:
Slackware64-current (Fri Oct 5 22:43:41 UTC 2018)
Cinnamon-3.8.9
Qt5-5.9.6
qBittorrent-4.1.2+

Qt should know that my tray is there, because I have KeePassXC, Qt5 is a dep, and it is showing up in the tray. (far left icon)

screenshot

qBittorrent is actually running, and the tray does make a spot for it, it's just that the icon is not showing. I can right click in the spot where it is and all functionality is there.

screenshot2

@ipkpjersi
Copy link
Author

ipkpjersi commented Oct 10, 2018

I'm the person who opened this issue and I am running Xfce 4.12 on Ubuntu 16.04.

Here is my panel configuration:

edit: I just tried adding the Indicator Plugin to my Xfce Panel 1 but it did not help.

edit 2: I found a nice workaround for people who don't want to wait a couple years for this issue to be found and fixed. You can download kDocker and modify your qBittorrent launcher to launch with kdocker - simply put kdocker in front of the qBittorrent launcher command. I believe it should automatically minimize to the tray when launching and when minimizing, the only issue for me is there was no icon for kdocker so I right clicked the tray and went to options -> set icon and chose a qBittorrent icon. I now have a full system tray icon.

@xlucn
Copy link

xlucn commented Dec 28, 2018

Update 2019-05-04:
Somehow the problem seems to be gone for now. Archlinux + AwesomeWM. Not sure why : )

====

Update:
I have the same problem again in awesomewm every time I restart awesome. The problem may be universal, not specific to any DE/WM.

====

Also having the issue. But I don't know if it's just in my case, that I can bring the icon back by toggle the 'show qBittorrent in the notification area' option off and on again(another example of IT rule No. 1 XD). And the icon disappeared only after every time I restart the Gnome shell(by alt+f2 r).

Using Archlinux + Gnome + TopiconPlus. I might not have much more information for you. Hope you can solve it soon!

@slashbeast
Copy link

Found the solution.

I am running ~amd64 Gentoo here FWIW with just Openbox and not much else.

When I was starting qbittorrent it was seding to stdout/err QSystemTrayIcon::setVisible: No Icon set. I simply started qt5ct, selected Icon themes, then Tango, as it looked like no icons were set, hit apply and now qbittorrent does get a tray icon.

@ipkpjersi
Copy link
Author

ipkpjersi commented Jan 21, 2019

I was unable to test the qt5ct fix. When I try running qt5ct, I get an error about needing to unset QT_STYLE_OVERRIDE and about QT_QPA_PLATFORMTHEME not being set correctly so I did just that with unset QT_STYLE_OVERRIDE but it still complains about QT_QPA_PLATFORMTHEME even though echo $QT_QPA_PLATFORMTHEME returns appmenu-qt5.

This seems to be a widespread issue so I'm going to guess that unless other people confirm your solution works, it's a solution, not the solution, and this is probably a multifactor issue with many causes.

I'm using kdocker as a workaround and it works quite well other than not remembering the icon.

@olfek
Copy link

olfek commented Feb 9, 2019

I'm experiencing the same issue in Linux Mint 19.1 Cinnamon edition (based on Ubuntu 18.04).

@Nigel-727
Copy link

I'm experiencing the same issue in Linux Mint 19.1 Cinnamon edition (based on Ubuntu 18.04).

The same problem here. Also Linux Mint 19.1 Cinnamon...

@ardadem
Copy link

ardadem commented Feb 15, 2019

Same problem. I'm using latest GNOME (based on Arch Linux).

@PrzemekSkw
Copy link

Same problem on Ubuntu 18.10.

@averypierce
Copy link

averypierce commented Apr 15, 2019

I simply started qt5ct, selected Icon themes, then Tango, as it looked like no icons were set, hit apply and now qbittorrent does get a tray icon.

Worked for me on Manjaro. Qt5 Settings -> Icon Theme -> Yaru
On gnome you can use gsettings get org.gnome.desktop.interface icon-theme to find the name of your icon theme.

@ForeverZer0
Copy link

ForeverZer0 commented Jun 8, 2019

The qt5ct really is the solution, not just "a" solution, and will stand true for other Qt-based apps. You obviously need to set it up correctly so that Qt-based applications integrate well into Gnome, such as color/theme, icons, and of course tray icons, and this includes correctly setting the environment variable and the tray notifier settings.

Also keep in mind that Gnome removed tray icons (aside from the build-in ones) by default, and has nothing to do with Qt. This is easily fixed with a basic shell extension, but your GTK-based apps won't be getting tray icons either unless added back.

If using Gnome, this issue has nothing specifically to do with qbittorrent, and just a matter of getting your system configured properly with how to handle Qt apps.

@nightsky30
Copy link

nightsky30 commented Jun 8, 2019

What about users that experience this with XFCE? Same solution?

@ipkpjersi
Copy link
Author

Q5ct or q5cl or whatever did not solve this for me. I just ended up using KDocker as a workaround.

@ForeverZer0
Copy link

@ipkpjersi
I have this...

export QT_QPA_PLATFORMTHEME=qt5ct
export QT_AUTO_SCREEN_SCALE_FACTOR=0

...in /etc/environment, and after restarting my session, everything worked as expected with Qt-based apps (such as VLC looking good, etc). For tray notifications, there is a specific stylesheet that needs activated in qt5ct called traynotification-simple.qssthat you may need to also enable. After doing this, qbittorrent allowed me to enable tray notification, VLC had the qt5ct option enabled in its interface options, and other Qt apps all take on the look I configured to match Gnome style.

@ilya-fedin
Copy link

ilya-fedin commented Mar 2, 2020

When I experimented with tray on MATE, I discovered that icon is presenting with notification area applet (even with SNI), but not with indicator applet.
Qt has some hack for working with ubuntu's indicator service and I dicovered that qbittorrent's icon file is empty by some reason, but all other qt apps are fine:
image
This is very strange...
PS: icon file can be discovered with D-feet

@JHerseth
Copy link

JHerseth commented Aug 4, 2020

Similar issue on Pop!_OS 20.04. Icon shows in App Indicator with the .deb installation, but not when using flatpak

@ilya-fedin
Copy link

but not when using flatpak

Qt's SNI implementation doesn't work with flatpak

@tawfeqfauzi
Copy link

\

but not when using flatpak

Qt's SNI implementation doesn't work with flatpak

Is there any way to fix that?

@ilya-fedin
Copy link

Is there any way to fix that?

Maybe by a very loud complaining in the Qt bugtracker 🙈

I've implemented a platformtheme plugin to fix this for myself some time ago:

flatpak install org.kde.PlatformTheme.QtSNI
flatpak override --env=QT_QPA_PLATFORMTHEME=qtsni

@FranciscoPombal
Copy link
Member

Thanks to everyone who looked into this. Looks like the issue is due to improper system setup (wthhttps://github.com//issues/9518#issuecomment-500153965) or some other issue which cannot be reproduced (#9518 (comment)) - there are no issues on a vanilla install of Xubuntu 18.04 or Xubuntu 20.04, and those reports are very old.

#9518 (comment) flatpak/snap/whatever is not officially supported. Report issues with them to their respective repositories.

@qbittorrent qbittorrent locked as resolved and limited conversation to collaborators Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
OS: Linux Issues specific to Linux distributions
Projects
None yet
Development

No branches or pull requests