QT apps make Gnome choppy/freeze when screen-magnifier/toolkit-accessibility are enabled

This problem was bugging me since switching to Gnome around December, but I’ve finally figured it out. Maybe somebody will benefit from this.

The issues

  • dragging columns in KeePassXC would make the entire desktop choppy
  • playback in Shotcut would make the entire desktop freeze for a couple seconds at a time
  • interacting with trey icons that appear thanks to the “AppIndicator and KStatusNotifierItem Support” extensions could freeze for a couple of seconds or indefinitely (had to restart gnome with killall -HUP gnome-shell)
  • dragging the crop area in Pix was choppy

Root cause

It was because of the “accessibility toolkit” that I had enabled to get the desktop magnifier. Disabling accessibility toolkit makes the problems go away.

Solution

If you have the “screen magnifier” enabled (gsettings set gsettings set org.gnome.desktop.a11y.applications screen-magnifier-enabled true), then accessibility toolkit will re-enable itself after logging in again. So you need to run gsettings set org.gnome.desktop.interface toolkit-accessibility false after Gnome starts.

I’m doing that with an file in the autostart directory (~/.config/autostart/gnome-accessibility-toolkit-disabler.desktop):

[Desktop Entry]
Version=1.0
Exec=/bin/sh -c "gsettings set org.gnome.desktop.interface toolkit-accessibility false"
Name=Gnome Accessibility Toolkit disabler
Terminal=true
Type=Application

More context

This issue was happening on two laptops.
One has an integrated Intel GPU. I tested both video-linux and video-modesetting drivers (more info on setting the drivers).
The other has a Nvidia GPU. I tested both noveau and video-nvidia driver.

It looks like the choppiness was less pronounced on video-modesetting driver on Intel, and with the proprietary driver (video-nvidia) on Nvidia.

It was happening both on Wayland and X11, but normally I use X11.