NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.15k stars 13.42k forks source link

Qt6 syncthingtray on GNOME is broken #295345

Closed tschai-yim closed 5 months ago

tschai-yim commented 5 months ago

Describe the bug

syncthingtray now uses Qt6 which fails to find the system tray when using the qgnomeplatform platform theme plugin (qt.platformTheme = "gnome" in home manager). It instead shows the popup seen below and then exits.

qgnomeplatform is unmaintained was superseded by qadwaitadecorations. For home manager, a fix (https://github.com/nix-community/home-manager/pull/5156) is underway.

The entire log is:

Info: Single instance application ID: Syncthing Tray-Martchus-1000
QFont::fromString: Invalid description '(empty)'
qt.dbus.integration: Could not connect "org.freedesktop.NetworkManager" to "stateChanged" : Type not registered with QtDBus in parameter list: QNetworkManagerInterface::NMState
qt.dbus.integration: Could not connect "org.freedesktop.NetworkManager" to "connectivityChanged" : Type not registered with QtDBus in parameter list: QNetworkManagerInterface::NMConnectivityState
qt.dbus.integration: Could not connect "org.freedesktop.NetworkManager" to "deviceTypeChanged" : Type not registered with QtDBus in parameter list: QNetworkManagerInterface::NMDeviceType
qt.dbus.integration: Could not connect "org.freedesktop.NetworkManager" to "meteredChanged" : Type not registered with QtDBus in parameter list: QNetworkManagerInterface::NMMetered

Previously mentioned here

Steps To Reproduce

Make Qt use qgnomeplatform in a GNOME environment and start syncthingtray.

Expected behavior

It should start as a system icon and not throw any errors.

Screenshots

Broken Qt6 version

Popup before exiting with code 1: image

Half broken Qt6 version before breaking commit

image image The popup above is at the completely different end of the screen. Is an unrelated issue to do with Wayland.

Working Qt5 version before breaking commit (which removes it)

image image

Additional context

Code

The relevant piece of code causing this popup can be found here. Seems Qt deems the system tray as not available.

Commits

This commit completely breaks the Qt6 version. Before this syncthingtray-qt6 does startup but has a pixilated icon and doesn't use the GNOME context menu popup but instead starts its own context menu. Qt5 worked perfectly up until the commit above where it was removed.

Loaded plugins

Logs were gathered using QT_DEBUG_PLUGINS=1.

The Qt5 version at commit 60a7f5155487f122c7674dbdc2911e5d48c12907 (right before the breaking commit) loads:

adwaita-qt-1.4.2/lib/qt-5.15.12/plugins/styles/adwaita.so 
libXcursor-1.2.1/lib/libXcursor
qgnomeplatform-0.8.4/lib/qt-5.15.12/plugins/platformthemes/libqgnomeplatformtheme.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/bearer/libqconnmanbearer.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/bearer/libqgenericbearer.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/bearer/libqnmbearer.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/imageformats/libqgif.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/imageformats/libqico.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/imageformats/libqjpeg.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/platforms/libqxcb.so 
qtbase-5.15.12-bin/lib/qt-5.15.12/plugins/xcbglintegrations/libqxcb-glx-integration.so 
qtsvg-5.15.12-bin/lib/qt-5.15.12/plugins/iconengines/libqsvgicon.so 
qtsvg-5.15.12-bin/lib/qt-5.15.12/plugins/imageformats/libqsvg.so 
qtwebengine-5.15.16-bin/lib/qt-5.15.12/plugins/imageformats/libqpdf.so

The Qt6 version on the same commit loads the following:

adwaita-qt-1.4.2/lib/qt-6/plugins/styles/adwaita.so
qgnomeplatform-0.8.4/lib/qt-6/plugins/platformthemes/libqgnomeplatformtheme.so
qtbase-6.6.2/lib/qt-6/plugins/imageformats/libqgif.so
qtbase-6.6.2/lib/qt-6/plugins/imageformats/libqico.so
qtbase-6.6.2/lib/qt-6/plugins/imageformats/libqjpeg.so
qtbase-6.6.2/lib/qt-6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
qtbase-6.6.2/lib/qt-6/plugins/platforms/libqxcb.so
qtbase-6.6.2/lib/qt-6/plugins/tls/libqcertonlybackend.so
qtbase-6.6.2/lib/qt-6/plugins/tls/libqopensslbackend.so
qtbase-6.6.2/lib/qt-6/plugins/xcbglintegrations/libqxcb-glx-integration.so
qtsvg-6.6.2/lib/qt-6/plugins/iconengines/libqsvgicon.so
qtsvg-6.6.2/lib/qt-6/plugins/imageformats/libqsvg.so
qtwebengine-6.6.2/lib/qt-6/plugins/imageformats/libqpdf.so

The Qt6 version after the breaking commit and the latest fixes (commit a907ea8faae92334d849f4793c2c6c4edaff9006) loads:

adwaita-qt-1.4.2/lib/qt-6/plugins/styles/adwaita.so
qgnomeplatform-0.8.4/lib/qt-6/plugins/platformthemes/libqgnomeplatformtheme.so
qgnomeplatform-0.8.4/lib/qt-6/plugins/wayland-decoration-client/libqgnomeplatformdecoration.so
qtbase-6.6.2/lib/qt-6/plugins/networkinformation/libqglib.so
qtbase-6.6.2/lib/qt-6/plugins/networkinformation/libqnetworkmanager.so
qtbase-6.6.2/lib/qt-6/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
qtwayland-6.6.2/lib/qt-6/plugins/platforms/libqwayland-generic.so
qtwayland-6.6.2/lib/qt-6/plugins/wayland-graphics-integration-client/libqt-plugin-wayland-egl.so
qtwayland-6.6.2/lib/qt-6/plugins/wayland-shell-integration/libxdg-shell.so

Notify maintainers

@doronbehar

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.21, NixOS, 24.05 (Uakari), 24.05.20240309.3030f18`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/8kvxlrdqajjq8q8rm1vj8ksv8d64xxsf-nra828scc8qs92b9pxra5csqzffb6hpl-source`

Add a :+1: reaction to issues you find important.

tschai-yim commented 5 months ago

Interestingly 8c8cf43fcd70b2ac61abe4d03af516d6b69b13ca the master parent commit of the breaking commit 3deaab7643f89048f2ac8e2382dcdb5e04f1bb87 also still has a half working Qt6 version even though nothing of relevance for Linux should have changed.

doronbehar commented 5 months ago

Without yet delving into all the details, do you have NetworkManager enabled?

tschai-yim commented 5 months ago

Yes the service is running and everything else involving it works as expected. Also the half broken Qt6 version still functionally works meaning it can connect to the instance.

doronbehar commented 5 months ago

I have no idea how to debug this unfortunately, also this is not reproducible on my machine.

tschai-yim commented 5 months ago

Well good news. Seems the latest unstable release has a half broken but still half functioning version again. Only problem left is the icon and that it doesn't use the built-in context menu: image For the icon, there was actually an SVG library that was added during the upgrade. I'll see if I can reproduce it on a VM if I can't solve it from here.

tschai-yim commented 5 months ago

Nvm was on an old version. It's still completely broken on GNOME. I tried out the KDE VirtualBox image and there the latest unstable release works as expected. Maybe a GNOME VM will reproduce the issue.

tschai-yim commented 5 months ago

Was about to write that I got it reproduced on a default GNOME installation, but I noticed I forgot to install the appindicator extension which fixed the issue in the VM. So it's probably something with my config, not with the package itself.

doronbehar commented 5 months ago

Haha OK these are great news. Perhaps upstream could have helped you figure that out if this image:

Had mentioned the appindicator gnome extension?

tschai-yim commented 5 months ago

That image is empty for me. I did have the extension already installed on my actual system, and it worked flawlessly previously, as it does with for example Flameshot even now. The extension supports multiple tray APIs though (I think), so maybe my config breaks one of them while the others are fine. Also, I didn't find any bugs related to appindicator extension on NixOS or GNOME in general, and neither their nix package nor actual normal releases have seen any updates in the last few months.

tschai-yim commented 5 months ago

So I narrowed it down to this home manager config:

qt.platformTheme.name = "gnome";

which then used an unmaintained platform theme plugin. So excuse the caused commotion, I'll fix the issue in home manager and update this issue's description in case someone stumbles onto the same problem.