Wayland Default Icon instead of Proton Icon
Expected Behavior
Proton Mail Bridge should have the same icon as the X11 application when using wayland.
Current Behavior
Proton Mail Bridge has the Wayland Default Icon in the taskbar and as app icon.
Possible Solution
Steps to Reproduce
- Start Proton Mail Bridge with Wayland
Version Information
Proton Mail Bridge v3.6.1 on Arch Linux with Wayland
Context (Environment)
Screenshots:
Thanks for the report, this seems to be a Qt issue.
It could be fixed in a newer version, but we are unable to upgrade at this point.
It's technically not a Qt issue but rather wayland issue.
Here's some background:
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/52
It is possible to display icon but you need to setup desktop file in a specific way. Basically, .desktop file must have the same app id (window class on X11) as app itself.
So would it help if this application would ship with a .desktop file or should every user create a file themselves?
https://github.com/ProtonMail/proton-bridge/blob/master/dist/proton-bridge.desktop
It already does
This is not a Qt issue. Applications cannot set their own window icon on Wayland, thus setWindowIcon is a no-op.
The actual correct solution here is to use QGuiApplication::setDesktopFileName() with the name of the .desktop without the .desktop suffix. So if the .desktop file is installed as /usr/share/applications/proton-bridge.desktop then the corresponding call would be QGuiApplication::setDesktopFileName("proton-bridge"). This will set the appID on Wayland which will allow the WM to match the open window to the desktop file, it can then retrieve which icon to use from that. It's a no-op when running in X11/Xwayland, so is safe to use without guards.