Qt applications in GNOME Wayland

Hi

I’m using GNOME in the Wayland session but I like to use a few Qt (actually, KDE) applications like the text editor Kate. They look quite ugly in the GNOME Wayland session and they can be hardly resized. As a solution, I put

# for KDE applications in GNOME Wayland to be resizable
export QT_QPA_PLATFORM=xcb

in /etc/environment to force Qt applications to use X11, but it looks like a radical solution…

Is there anything better I could do?

thanks in advance

Have you tried using qgnomeplatform?

By using do you mean install it or something else?

You install the package and then set QT_QPA_PLATFORMTHEME='gnome'

You probably need to also undo the change you made above.

But this would still imply to do this setting at the system level, while I was wondering if there’s a way to do that for a single user…

You don’t have to set it /etc/environment. You can put it in the user’s environment instead.

Ok, thanks. Last time I tried setting that variable in the user’s environment that variable wasn’t picked up… maybe I did something wrong back then. I’ll keep you posted.

Make sure the environment variable is available to the graphical session if that is where the application is being launched from.

Isn’t that automatic if I set it in .zshrc?

Not usually. zsh isn’t usually started until you open a shell.

One way would be using something like this.

OK, so I have to put the environment variable in ~/.zshenv and then it’s picked up by the desktop environment. However, I can only use “xcb”: although the qgnomeplatform-qt6 and qgnomeplatform-qt5 were already correctly installed, I cannot use “gnome” for that variable (as suggested here), because I have this error:

qt.qpa.plugin: Could not find the Qt platform plugin "gnome" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Are you settings the right variable?

It is a different one than from your previous workaround.

QT_QPA_PLATFORMTHEME not QT_QPA_PLATFORM

Opps… you’re right… in any case, setting the platform theme to gnome doesn’t change anything visually and the platform set to xcb is still required anyway.

I’ll stay with QT_QPA_PLATFORM=xcb in ~/.zshenv

It fixes the problem on a per-user level.

Thanks again!

An other way would be the tweaks extention:

tweaks >> appearance = legacy applications

1 Like

Again, this would not solve the problem of Wayland: qt applications under gnome have to use xcb