Skip to content

Instantly share code, notes, and snippets.

@AntonFriberg
Created August 9, 2026 09:05
Show Gist options
  • Select an option

  • Save AntonFriberg/62c74fe3e4e0d5447bbeaa3f245c013d to your computer and use it in GitHub Desktop.

Select an option

Save AntonFriberg/62c74fe3e4e0d5447bbeaa3f245c013d to your computer and use it in GitHub Desktop.
Fix laggy VSCode scrolling on Ubuntu

Fixing Laggy Scrolling & UI Sluggishness in VS Code on Ubuntu 24.04

TL;DR: Ubuntu turns on an accessibility service that makes Electron apps (VS Code, Spotify, Slack, etc.) run a hidden "screen reader" mode. Even if you don't use one. This kills scrolling and UI performance.


Symptoms

  • Scrolling in the editor feels jittery or "heavy" instead of smooth
  • Typing feels slightly delayed
  • Tabs, menus, and the file sidebar feel sluggish
  • The problem affects other apps too: Spotify feels laggy, Chrome pages scroll poorly, Slack is slow to switch channels

Quick check

Open a terminal and run this while VS Code is running:

code --status

Find the line that says Screen Reader. If it shows yes and you don't use a screen reader, you have this problem:

Screen Reader:    yes    ← this is the culprit

What's going on?

Ubuntu 24.04 includes a service called AT-SPI (Assistive Technology Service Provider Interface). It's the bridge that lets screen readers like Orca work with applications. Ubuntu starts it automatically for everyone, just in case you need it.

The problem: Electron (the framework behind VS Code, Spotify, Slack, Discord, and many other desktop apps) detects this service at startup and thinks "I need to prepare everything for a screen reader." It builds an entire second copy of the user interface (an "accessibility tree") and keeps it in sync with every scroll, keystroke, and animation.

If you don't use a screen reader, you're paying a 2–5× performance penalty for something you never asked for.


The fix

Three options, from quickest to most permanent.

Option 1: Edit your shell config (quick, easy to undo)

Add these two lines to ~/.bashrc or corresponding according to the shell of your choice:

export GTK_MODULES=""
export QT_ACCESSIBILITY=0

Then log out and back in. This tells your apps "don't load the accessibility bridge."

Option 2: Disable the accessibility service (recommended)

This stops the AT-SPI bus from ever starting, cleanly and permanently:

systemctl --user mask at-spi-dbus-bus.service
systemctl --user stop at-spi-dbus-bus.service

If you ever need it back:

systemctl --user unmask at-spi-dbus-bus.service

Option 3: Remove the package entirely

If you're certain you don't need any accessibility features:

sudo apt purge at-spi2-core

Before running this, check what else would be removed:

apt purge --dry-run at-spi2-core

Some desktop applications list it as a dependency even if they work fine without it, so review the list before confirming.


Verify the fix worked

  1. Log out and back in (or restart your computer).
  2. Launch VS Code.
  3. Run code --status in a terminal.
  4. Confirm the line now says Screen Reader: no.
  5. Open a file and scroll — it should be smooth.

It's not just VS Code

Any app built on Electron or Chromium is affected the same way:

Application What you'll notice
VS Code / VSCodium Laggy scrolling, sluggish file sidebar
Google Chrome / Chromium Jittery page scrolling, slow tab switching
Spotify Slow playlist browsing, laggy UI
Slack Sluggish typing, slow channel switching
Discord Laggy chat scrolling
Obsidian Jittery note editing
Signal Desktop Slow message rendering
Figma desktop app Sluggish canvas

All of these use the same Chromium engine underneath. Disabling the accessibility bus fixes all of them at once.


Is this a bug?

Not really — every piece is working as intended:

  • Ubuntu ships AT-SPI so accessibility tools work out of the box.
  • Electron correctly enables accessibility support when it detects AT-SPI.
  • The performance cost is a consequence of how Linux accessibility works (D-Bus round-trips per query), not a bug in any single component.

The mismatch is that accessibility is enabled globally even when no accessibility tool is in use. On Windows and macOS the accessibility APIs are always on but have much lower overhead because they're built into the OS compositor rather than running over a separate D-Bus bus.


If you actually use a screen reader

Do not disable AT-SPI — you need it. Instead, try these to improve performance:

  • Turn on GPU acceleration. Run code --status and check GPU Status → gpu_compositing says enabled. If it doesn't, make sure your graphics drivers are installed.
  • Use custom title bar. In VS Code settings: "window.titleBarStyle": "custom" (this is the default, but some themes change it).
  • Try disabling extensions. Run code --disable-extensions to see if a specific extension is causing lag.
  • Use Wayland. VS Code on Ubuntu 24.04 uses Wayland by default. If you switched to X11 for compatibility, try switching back — Wayland generally has better GPU compositing.

Note for users with custom setups

If you use a custom window manager (Hyprland, Sway, niri) or a Nix-based configuration, the situation can be harder to diagnose. Custom setups often have their own environment variable handling that can disagree with the systemd user environment. You might see the fix work when launching VS Code from the app menu but not from a terminal, or vice versa.

In these cases, check both:

echo $GTK_MODULES                         # your shell
systemctl --user show-environment | grep GTK_MODULES   # systemd

If they show different values, you have an environment mismatch, make sure your fix applies to both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment