For some time, I’ve been trying to run my Linux under Wayland. It’s… always complicated. VERY complicated.

I have what people call the “unholy trinity” – Wayland, NVidia GPU (in a laptop to make things worse), and I use an Electron app (Pulsar). Pulsar is my main editor, so it’s basically “the reason I use a computer most of the time” really.

So it was a good surprise when I found out that things work… except…

Gimp.

And Darktable.

These flickered like crazy. And because they are image editors, this flickering is insane – it makes editing things essentially impossible (imagine you’re adjusting brightness and the screen is flickering between darker and lighter, and then stops… in the wrong frame, meaning you have no idea if it’s correct or not). So I tried to track the problem, and I finally have a solution (hopefully). This post will give the results, but the TL;DR; is – update your Linux (Ubuntu 24.04 is the MINIMUM version that you need), update your KDE to at least 6.2 (or use some recent desktop env with good wayland support), don’t use the Open Kernel NVidia driver, and update your Xwayland to at least version 24.0.

Ubuntu

Here are the problems: if you have an old Ubuntu, screen sharing won’t work. Don’t ask me why, the error is some weird API that’s not present, and I honestly have no idea why you have to update to a recent Ubuntu so that API appears (even if you have the exact same versions of KDE, OBS, Firefox, etc). So you need to upgrade your Ubuntu.

KDE

Second thing is KDE. KDE 6.2 adds some good support for Wayland – before that, everything is broken in some way or another. I am using KDE 6.3.5, and to update to such a recent KDE version I had to do some weird stuff that I don’t really recommend (basically, add KDE Neon packages into Ubuntu, make a backup of /etc/os-release, upgrade the packages then copy back the /etc/os-release otherwise some packages won’t detect you’re Ubuntu and will try to find a Neon linux distro that doesn’t exist anywhere). The first problem I had with KDE is that the shadows where in a different position (and size!) than the windows – menus appeared very far from where they should, and it somehow appeared that KDE thought that the window was “AxY” size, but when calculating where the menus should appear, it was appearing as “A+20%xB+20%”.

In fact, that was what was happening. I fixed that by adding a line in /etc/environment with the contents export QT_SCREEN_SCALE_FACTORS=1. And that fixed the issue

NVidia

I was using the Open Kernel NVidia driver, and that was working fine… but on Wayland, I had some problems. I have two monitors, and when I looked at my laptop’s notebook everything seemed fine, but when I was looking at my external monitor, it seemed that the laptop one was flickering. In fact, I could see the same issue in the login screen. Searching the web, I found that NVidia have something called GSP Firmware that can cause these flickerings, but you can only disabled that in the closed-source drivers. This question was where I found the issue, and the fix is to disable this firmware, but first let’s appreciate the wonderful response for this question on why you can’t disable on the open Kernels:

it would be nice if a piece of software that feels to me is still in early alpha, that was previously opt-out, didn’t become a backbone part of the driver, but it’s nvidia after all, what can you do about it. they certainly don’t have any resources/talented engineers to work out the kinks of the linux driver.

Emphasis mine. Unfortunately, this is how it feels – a multi-billion company that can’t fix some very simple issue. Anyway, to disable that, open /etc/default/grub and add into GRUB_CMDLINE_LINUX_DEFAULT the line nvidia.NVreg_EnableGpuFirmware=0. There are some small, but noticeable, slow flickerings on native wayland apps that also disappeared with this flag, so it’s a win for me. After updating this line in grub, you have to call sudo update-grub and restart your machine, by the way.

Xwayland

Ubuntu LTS doesn’t have the latest Xwayland. For me, that translated to “every old app that used X11 APIs” (for example, GIMP, Darktable, Geeqie, etc) got horrible – and I really mean horrible flickering. I don’t have a video, but it was VERY bad, and basically made some of these apps unusable. Newer Xwayland versions have something called “explicit sync” which solve these flickerings, but unfortunately it’s not available by default – you’ll need to install a PPA to use it. I solved by installing the PPA:

sudo add-apt-repository ppa:bvitnik/xwayland-noble-backports
sudo apt upgrade

That upgraded Xwayland, and luckily, you don’t need to reboot your machine – you’ll only need to killall Xwayland, see everything that uses X11 crash, and then open them again.

In my case, that also crashed Ibus support. In my machine, everytime I start KDE I have a notification saying that I’m using the X11 IBus support, and that I need to unset some env vars, etc. The easiest way to solve this is to run im-config and then choose to update your config, and in the “Input Method Configuration” you’l choose none. This…. don’t work for me – I get some “ghost accents” like I’m typing something in a textbox, select another app, and when I get back to the textbox I have a trailing ~ for example, so I left on “default” and then ignored the warning, basically.

Electron

With these configs, Electron apps work well – but they are still not Wayland native (for some reason I would not dare to understand). If you want to make them fully Electron apps, you’ll need to use the toggles enable-features=UseOzonePlatform --ozone-platform=wayland. I did an alias to add these on Pulsar, but then I remember I’m a core committer on the project so I just opened up a PR against the script to detect Wayland and then add these toggles automatically

Screenshot apps

I had some problems with some screenshot apps, for example Flameshot (they only detected one screen, or things like that). To fix these, I edited their .desktop files and added some env vars – for Flameshot, you’ll run sudo vi /usr/share/applications/org.flameshot.Flameshot.desktop and add the following lines:

X-KDE-DBUS-Restricted-Interfaces=org.kde.kwin.Screenshot,org.kde.KWin.ScreenShot2

Exec=... and/or other keys, like X-DBUS-ServiceName=... and similar. This will allow you to take screenshots of all screens.

Conclusion?

Surprisingly, it works! And Steam games are now way faster than they were, and surprisingly, all my render bugs that I had on Xorg are gone!

I won’t lie – I didn’t actually expect to solve these issues. I really, really was ready to go back to Xorg (at least for editing photo apps, because these were very hard to handle with all the flickering) but surprisingly, things are working now.

So, as someone that used to say “Wayland is not ready, and it won’t be ready for a couple of years”, I am seriously impressed!