qbittorrent / qBittorrent

qBittorrent BitTorrent client
https://www.qbittorrent.org
Other
28.33k stars 3.98k forks source link

System tray icon missing #9518

Closed ipkpjersi closed 4 years ago

ipkpjersi commented 6 years ago

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 commented 6 years ago

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

ipkpjersi commented 6 years ago

My Tray icon style is normal.

zeule commented 6 years ago

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.

ipkpjersi commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

…. 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 commented 6 years ago

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 commented 6 years ago

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

ipkpjersi commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

ipkpjersi commented 6 years ago

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 commented 6 years ago

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

zeule commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

FtK259 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@zywo maybe you don't have system tray? https://github.com/qbittorrent/qBittorrent/blob/bdc788c8242e0abb4a1c2f140774e9bed7117ac1/src/gui/optionsdialog.cpp#L175-L181

zywo commented 6 years ago

@thalieht this one?

tray

thalieht commented 6 years ago

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

Furyspark commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 5 years ago

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!

fff7d1bc commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

Nigel-727 commented 5 years ago

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 commented 5 years ago

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

PrzemekSkw commented 5 years ago

Same problem on Ubuntu 18.10.

averypierce commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

ipkpjersi commented 5 years ago

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

ForeverZer0 commented 5 years ago

@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 commented 4 years ago

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 commented 4 years ago

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

ilya-fedin commented 4 years ago

but not when using flatpak

Qt's SNI implementation doesn't work with flatpak

tawfeqfauzi commented 4 years ago

\

but not when using flatpak

Qt's SNI implementation doesn't work with flatpak

Is there any way to fix that?

ilya-fedin commented 4 years ago

Is there any way to fix that?

Maybe by a very loud complaining in the Qt bugtracker :see_no_evil:

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 commented 4 years ago

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

https://github.com/qbittorrent/qBittorrent/issues/9518#issuecomment-668554533 flatpak/snap/whatever is not officially supported. Report issues with them to their respective repositories.