Closed peterhoeg closed 4 years ago
Uh, that is a difficult one. System trays behave quite differently between platforms and Qt does not abstract away many of those differences. It was hard enough to get the icons to look right on both macOS and Gnome 3 (and there still are issues).
Are there any error message from Qt in the console?
I can reproduce this on Kubuntu with KDE 5.56: the app icon is missing and the menu actions are mixed up. It seems to be a bug with PyQt 5.12 which is fixed in PyQt 5.13.
This his how it looks after updating with PyQt with pip:
I'm running with KDE frameworks 5.58 and pyqt 5.13. These are the transitive dependencies:
acl-2.2.53
atk-2.32.0
at-spi2-atk-2.32.0
at-spi2-core-2.32.1
attr-2.4.48
audit-2.8.5
avahi-0.7
bash-4.4-p23
bison-3.4.1
bzip2-1.0.6.0.1
bzip2-1.0.6.0.1-bin
bzip2-1.0.6.0.1-dev
cairo-1.16.0
cairo-1.16.0-dev
coreutils-8.31
cracklib-2.9.7
cups-2.2.11-lib
db-4.8.30
dbus-1.12.16
dbus-1.12.16-lib
dbus-glib-0.110
dconf-0.32.0-lib
dejavu-fonts-minimal-2.37
dns-root-data-2019-01-11
epoxy-1.5.3
expat-2.2.7
expat-2.2.7-dev
fontconfig-2.12.6
fontconfig-2.12.6-bin
fontconfig-2.12.6-dev
fontconfig-2.12.6-lib
freetype-2.10.1
freetype-2.10.1-dev
fribidi-1.0.5
gcc-7.4.0-lib
gdbm-1.18.1
gdk-pixbuf-2.38.1
gettext-0.19.8.1
glib-2.60.4
glib-2.60.4-dev
glibc-2.27
glibc-2.27-bin
glibc-2.27-dev
glibc-iconv-2.27
gmp-6.1.2
gnum4-1.4.18
gnutls-3.6.8
gobject-introspection-1.60.2
graphite2-1.3.6
gtk+3-3.24.10
gzip-1.10
harfbuzz-2.5.3
icu4c-64.2
iptables-1.8.3
jasper-2.0.16
kbd-2.0.4
kexec-tools-2.0.19
kmod-26
libapparmor-2.13.1
libcap-2.27-lib
libdaemon-0.14
libdrm-2.4.99
libdrm-2.4.99-bin
libdrm-2.4.99-dev
libelf-0.8.13
libevdev-1.7.0
libevent-2.1.10
libffi-3.2.1
libffi-3.2.1-dev
libgcrypt-1.8.4
libGL-1.0.0
libGL-1.0.0-dev
libglvnd-1.0.0
libgpg-error-1.36
libgudev-232
libICE-1.0.9
libidn2-2.2.0
libinput-1.13.4
libjpeg-turbo-2.0.2
libmicrohttpd-0.9.64
libmnl-1.0.4
libnetfilter_conntrack-1.0.7
libnfnetlink-1.0.1
libnftnl-1.1.3
libossp-uuid-1.6.2
libpcap-1.9.0
libpciaccess-0.14
libpng-apng-1.6.37
libpng-apng-1.6.37-dev
libseccomp-2.4.1-lib
libselinux-2.7
libSM-1.2.3
libtasn1-4.13
libtiff-4.0.10
libunistring-0.9.10
libwacom-0.33
libX11-1.6.7
libX11-1.6.7-dev
libXau-1.0.9
libXau-1.0.9-dev
libxcb-1.13.1
libxcb-1.13.1-dev
libXcomposite-0.4.5
libXcursor-1.2.0
libXdamage-1.1.5
libXdamage-1.1.5-dev
libXdmcp-1.1.3
libXext-1.3.4
libXext-1.3.4-dev
libXfixes-5.0.3
libXfixes-5.0.3-dev
libXft-2.3.3
libXi-1.7.9
libXinerama-1.1.4
libxkbcommon-0.8.4
libxml2-2.9.9
libXrandr-1.5.2
libXrender-0.9.10
libXrender-0.9.10-dev
libxshmfence-1.3
libXtst-1.2.3
libXv-1.0.11
libXvMC-1.0.11
libXxf86vm-1.1.4
libXxf86vm-1.1.4-dev
libyaml-0.2.2
linux-headers-4.19.16
linux-pam-1.3.1
llvm-7.1.0-lib
locale-1003.1-2008
lz4-1.9.1
maestral-gui-0.3.1
mariadb-connector-c-2.3.7
mesa-19.1.3
mesa-19.1.3-dev
mesa-19.1.3-drivers
mtdev-1.1.5
ncurses-6.1-20190112
nettle-3.4.1
openssl-1.0.2s
openssl-1.0.2s-bin
openssl-1.0.2s-dev
p11-kit-0.23.16.1
pango-1.43.0
pcre2-10.33
pcre-8.43
perl-5.28.2
pixman-0.38.4
pkg-config-0.29.2
postgresql-9.6.15-lib
python3-3.7.4
python3.7-argh-0.26.2
python3.7-asn1crypto-0.24.0
python3.7-backports_abc-0.5
python3.7-blinker-1.4
python3.7-certifi-2019.6.16
python3.7-cffi-1.12.3
python3.7-cffi-1.12.3-dev
python3.7-chardet-3.0.4
python3.7-click-7.0
python3.7-cryptography-2.7
python3.7-cryptography-2.7-dev
python3.7-dbus-python-1.2.4
python3.7-dbus-python-1.2.4-dev
python3.7-dropbox-9.4.0
python3.7-entrypoints-0.3
python3.7-funcsigs-1.0.2
python3.7-idna-2.8
python3.7-jeepney-0.4
python3.7-keyring-18.0.1
python3.7-keyrings.alt-3.1.1
python3.7-mock-2.0.0
python3.7-packaging-19.0
python3.7-pathtools-0.1.2
python3.7-pbr-5.1.3
python3.7-pyasn1-0.4.5
python3.7-pycairo-1.18.1
python3.7-pycparser-2.19
python3.7-pygobject-3.32.1
python3.7-pygobject-3.32.1-dev
python3.7-pyOpenSSL-19.0.0
python3.7-pyOpenSSL-19.0.0-dev
python3.7-pyparsing-2.3.1
python3.7-pyqt-5.13.0
python3.7-pyqt-5.13.0-dev
python3.7-PyQt5.sip-4.19.18
python3.7-Pyro4-4.75
python3.7-pysocks-1.6.8
python3.7-PyYAML-5.1.1
python3.7-requests-2.22.0
python3.7-secretstorage-3.1.1
python3.7-serpent-1.27
python3.7-setuptools-41.0.1
python3.7-singledispatch-3.4.0.3
python3.7-six-1.12.0
python3.7-tornado-5.1
python3.7-u-msgpack-python-2.5.1
python3.7-urllib3-1.24.3
python3.7-watchdog-0.9.0
qtbase-5.12.0
qtbase-5.12.0-bin
qtdeclarative-5.12.0
qtdeclarative-5.12.0-bin
qtquickcontrols-5.12.0
qtsvg-5.12.0
qtsvg-5.12.0-bin
qtwayland-5.12.0
qtwayland-5.12.0-bin
qtwebchannel-5.12.0
readline-6.3p08
shadow-4.6
sqlite-3.28.0
systemd-242
systemd-242-lib
unbound-1.9.2-lib
util-linux-2.33.2
util-linux-2.33.2-bin
wayland-1.17.0
xcb-util-0.4.0
xcb-util-0.4.0-dev
xcb-util-image-0.4.0
xcb-util-keysyms-0.4.0
xcb-util-renderutil-0.3.9
xcb-util-wm-0.4.1
xkeyboard-config-2.27
xorgproto-2018.4
xz-5.2.4
zlib-1.2.11
zlib-1.2.11-dev
I suspect it may have something to do with Qt or KDE not liking to SVG files created by adobe illustrator.
As I said, I can reproduce the issue only with PyQt 5.12. But there, replacing the icon file with a PNG or another SVG from KDE's own theme works without problems.
OK, I'll do some digging.
No longer a problem on 0.4.0
It's a workaround and not a real a fix at the moment: unless on Gnome 3 or macOS, Maestral will use PNG icons.
Same problem on with the latest build 0.4.2 on Ubuntu 18.04 LTS and Gnome 3.28.2. My PyQT version is 5.13.1 so updating PyQT as suggested here does not really help.
I just managed to reproduce this on the same system. It seems to be a regression bug from Qt 5.13.0 to Qt 5.13.1 and unrelated to the issue in KDE Plasma.
It seems to be related to enabling HighDPI support in PyQt. I have removed the respective commands for now.
Could you try out the development branch pip install -U --pre maestral
and see if it fixes things for you?
It seems to be related to enabling HighDPI support in PyQt. I have removed the respective commands for now.
Could you try out the development branch
pip install -U --pre maestral
and see if it fixes things for you?
Still missing in 0.4.3-dev0. I do not have a HighDPI display on the Ubuntu machine, jist 1600x900 (old Thinkpad T440s) if it is anyhow related.
Uh, damn. Removing the HighDPI code fixed it for me, which makes it difficult to troubleshoot.
I never tried any other PyQT version I am a bit afraid downgrading it breaks something else
Yes there is a click able area, I can see it as a gap if I run others apps that uses the menu. Like having a transparent icon.
I never tried any other PyQT version I am a bit afraid downgrading it breaks something else
No need to downgrade because of this. I was just curious if its a new issue.
Yes there is a click able area, I can see it as a gap if I run others apps that uses the menu. Like having a transparent icon.
That's a good sign. It means that nothing too fundamental is broken, but rather that Qt is having trouble finding or displaying the icon. Do you get an error message "QSystemTrayIcon::setVisible: No Icon set" when starting the GUI?
Yes exactly QSystemTrayIcon::setVisible: No Icon set
when running the GUI.
Ok. Can you try the following in a Python console and tell me the return values?
from maestral.gui.resources import *
app = QtWidgets.QApplication([])
icon = get_system_tray_icon('idle')
print(icon.availableSizes())
print(QtGui.QIcon.themeSearchPaths())
icon.availableSizes()
should return a list of icon sizes, such as [PyQt5.QtCore.QSize(16, 16), PyQt5.QtCore.QSize(22, 22), PyQt5.QtCore.QSize(24, 24)]
, but it may return an empty list in your case. Similar, QtGui.QIcon.themeSearchPaths()
should return the paths where Qt searches for icons. One of them should end with "icon-theme-gnome" and should point to a directory within the maestral package. Can you confirm that this directory exists and contains a subdirectory "scalable/status/" with SVG files?
[]
['/usr/local/share/icons', '/usr/share/icons', '/var/lib/snapd/desktop/icons', ':/icons', '/home/igor/.local/lib/python3.6/site-packages/maestral/gui/resources/icon-theme-gnome']
What do you find at the location "/home/igor/.local/lib/python3.6/site-packages/maestral/gui/resources/icon-theme-gnome"?
~
➜ ls /home/igor/.local/lib/python3.6/site-packages/maestral/gui/resources/icon-theme-gnome
index.theme scalable/
~
➜ ls /home/igor/.local/lib/python3.6/site-packages/maestral/gui/resources/icon-theme-gnome/scalable/
status/
~
➜ ls /home/igor/.local/lib/python3.6/site-packages/maestral/gui/resources/icon-theme-gnome/scalable/status/
maestral-icon-disconnected-symbolic.svg maestral-icon-paused-symbolic.svg
maestral-icon-error-symbolic.svg maestral-icon-syncing-symbolic.svg
maestral-icon-idle-symbolic.svg
~
➜ cat /home/igor/.local/lib/python3.6/site-packages/maestral/gui/resources/icon-theme-gnome/index.theme
[Icon Theme]
Name=MaestralStatusIcons
Comment=Status icon for Maestral
Example=menubar_idle-symbolic
# KDE Specific Stuff
DisplayDepth=32
LinkOverlay=link_overlay
LockOverlay=lock_overlay
ZipOverlay=zip_overlay
DesktopDefault=48
DesktopSizes=16,22,32,48,64,72,96,128
ToolbarDefault=22
ToolbarSizes=16,22,32,48
MainToolbarDefault=22
MainToolbarSizes=16,22,32,48
SmallDefault=16
SmallSizes=16
PanelDefault=32
PanelSizes=16,22,32,48,64,72,96,128
# Directory list
Directories=scalable/status,
[scalable/status]
Context=Status
Size=16
MinSize=8
MaxSize=512
Type=Scalable
~
➜
That all looks as it should. Apart from the icon not actually loading of course.
A few more questions:
After running the above code, what do icon.name()
and QtGui.QIcon.hasThemeIcon(icon.name())
return?
What does QtGui.QIcon.themeName()
return?
Does the Maestral tray icon appear when you choose a different system icon theme in "Tweaks > Appearance"?
>>> from maestral.gui.resources import *
>>> icon = get_system_tray_icon('idle')
>>> print(icon.name())
>>> print(QtGui.QIcon.hasThemeIcon(icon.name()))
True
>>>
To confirm, the icon name is None
?! Or just an empty string?
Edit: Never mind, it's an empty string.
I am not really experienced with python but it looks like an empty string to me:
>>> print("xx"+icon.name()+"aa")
xxaa
>>> print(icon.name() is None)
False
Alright, I believe I have finally found the problem. It was a mistake in the icon names: I had renamed the SVG files for Gnome without changing their name in the code.
The reason why I could not reproduce it on my systems is that I have the icon files with the old names installed globally - it therefore always finds them. This was a bit frustrating, but certainly an exercise in attention to detail.
Expect a fix in the dev branch soon.
Ok, this should hopefully be fixed now in the dev branch. Could you try upgrading again with pip install -U --pre maestral
?
It turns out that having the icons pre-installed on my PC masked another set of issues specific to Gnome 3 and QSystemTrayIcon. It therefore took a bit longer to sort out.
Thanks, it works!
Great :) I'll leave the issue open until the next version is released.
Fixed in v0.4.3. Maestral now installs its icons in the appropriate location for Gnome 3: either /usr/local/icons/hicolor
or ~/.local/icons/hicolor
. Also, SVG icons are now used in KDE Plasma with PyQt 5.13 and higher.
Despite it being supposedly fixed, it seems I am experiencing this on Arch Linux in KDE Plasma 5.18.4.1, with PyQt 5.14.2 installed.
Running maestral gui
causes the program to initiate properly and a space where the icon should be to be created on the system tray. However, no actual icon shows (though you can still interact with it). Maestral was installed following the instructions in the main Github page, by running python3 -m pip install --upgrade maestral[gui]
. I've attached a screenshot so you can see it.
It works fine in XFCE under the same setup.
It seems to work fine on a fresh KDE Neon virtual machine:
Well, I'm not sure as to what could be causing this problem then, since this Arch+KDE is also a fresh install. Any suggestions for troubleshooting? Such as checking for missing icons or something?
Sorry, my post wasn't very helpful. It's just that supporting system tray icons across different desktops (or different versions of the same desktop environment) has been a bit of a pain.
On KDE Plasma, Maestral at the moment does not use "installed" system tray icons in the hicolor theme but rather just sets the icon directly. This is because there is no elegant way to install different icon sets for different desktop-environments with pip
and I had the impression (but may be wrong) that Gnome is used more often than KDE.
You can try the following from a Python prompt to see if the icons are loaded correctly:
from maestral_qt.resources import *
app = QtWidgets.QApplication([]) # needed to load icons
print(DESKTOP) # should return 'kde'
print(TRAY_ICON_DIR_SVG) # returns the icon file location used for KDE
isDarkStatusBar() # should return False in your case
icon = get_system_tray_icon('idle')
icon.isNull() # should return False
Could you post the output of the above commands?
Here it is:
from maestral_qt.resources import * app = QtWidgets.QApplication([]) # needed to load icons QSettings::value: Empty key passed QSettings::value: Empty key passed Icon theme "Papirus-Dark" not found. print(DESKTOP) # should return 'kde' kde print(TRAY_ICON_DIR_SVG) # returns the icon file location used for KDE /usr/lib/python3.8/site-packages/maestral_qt/resources/tray-icons-svg isDarkStatusBar() # should return False in your case False
icon = get_system_tray_icon('idle') icon.isNull() # should return False False
Tried installing papirus-icon-theme and setting it as the global icon theme, and upon running it again it threw a Icon theme "gnome" not found
error instead. Upon installing gnome-icon-theme, it went away, but still no dice, the icon is still not visible.
The current output is exactly like the above except for the Icon theme "Papirus-Dark" not found.
line.
The output all seems correct. Installing icon themes should not change anything, Maestral currently bypasses installed icon themes on KDE and just uses its own icons. You can therefore safely ignore the warnings about missing themes.
Could you try to create the tray icon manually as follows and see if it shows up or print any warnings?
tray = QtWidgets.QSystemTrayIcon()
tray.setIcon(icon)
If this does not work, can you try the PNG icons instead?
icon_png = QtGui.QIcon(TRAY_ICON_PATH_PNG.format('idle', 'dark'))
tray.setIcon(icon_png)
Do I need to run any import statements before I run those commands? It seems they aren't working properly simply by running them in the Python interpreter.
Running the first code section returns this:
tray = QtWidgets.QSystemTrayIcon() Traceback (most recent call last): File "
", line 1, in NameError: name 'QtWidgets' is not defined tray.setIcon(icon) Traceback (most recent call last): File " ", line 1, in NameError: name 'tray' is not defined
Running the second code section returns this:
icon_png = QtGui.QIcon(TRAY_ICON_PATH_PNG.format('idle', 'dark')) Traceback (most recent call last): File "
", line 1, in NameError: name 'QtGui' is not defined tray.setIcon(icon_png) Traceback (most recent call last): File " ", line 1, in NameError: name 'tray' is not defined
You'll need to run the commands from the previous post first! At least the following:
from maestral_qt.resources import *
app = QtWidgets.QApplication([])
icon = get_system_tray_icon('idle')
Okay, I've ran the commands and neither shows anything in the tray, nor do they output any warnings. And I set it to "show all elements" so it shouldn't be hiding any icons.
I guess this is both good and bad news: There is no direct issue with the code but it does not help much with trouble shooting...
I will set up a VM with Arch Linux and KDE Plasma and test this myself later this week.
So I just discovered what the problem was: I was doing the install with "sudo python3 -m pip" instead of "python3 -m pip". Somehow, by using sudo in the install the icon doesn't show in the systray (probably a permissions problem since you're installing system-wide?), but by not using it and installing as a normal user, it seems to work properly. Sorry for the trouble.
No worries, I'm glad you resolved the issue. But this is indeed strange and explains why I couldn't reproduce it.
I'm having the same issue in KDE Plasma 5.24.80 (git)
Where should I point the svgs? I've tried: ~/.local/share/icons/hicolor/512x512/apps /usr/local/icons/hicolor /usr/share/icons/
with no success.
@qumaciel, the first option ~/.local/share/icons/hicolor/512x512/apps
should be picked up correctly. Which icon names are you using? Maestral load the following icons if present in the active theme:
maestral_tray-disconnected
maestral_tray-error
maestral_tray-idle
maestral_tray-info
maestral_tray-paused
maestral_tray-syncing
There is long-standing bug in Qt 5, possibly also Qt 6 with using SVG system tray icons in KDE so PNG may be required. Which version of Maestral are you using? The latest moved the GUI to PyQt6 which may well fix any issues there.
That being said, Maestral should fall back to loading bundled icons at runtime if it cannot find any in the icon theme. This should "just work".
You can find the relative lines at https://github.com/samschott/maestral-qt/blob/653e33a4b53c5389490c16114dbda37091dc9db9/src/maestral_qt/resources/__init__.py#L96.
No icon on xfce4/Qubes. Neither I see any png icon files installed.
Describe the bug When running the GUI (which works), there is no icon for the Maestral entry in tray.
To Reproduce Launch
maestral gui
.Expected behaviour The standard logo to show.
System (please complete the following information):