How to Fix Blurry Electron Apps on Wayland (VS Code, Discord, Spotify, Chrome)
Tired of blurry text in VS Code, Discord, and Chrome when using fractional scaling on Wayland? Here is how to force native Wayland rendering with Ozone flags, Flatpak overrides, and global environment variables.
If you use fractional display scaling (such as 125%, 150%, or 175%) on modern Linux desktops running Wayland (GNOME 46/48 or KDE Plasma 6), you have almost certainly noticed that native GTK and Qt apps look razor sharp, while applications like VS Code, Discord, Spotify, Slack, Obsidian, and Google Chrome look fuzzy and pixelated.
This blurriness is not a bug in your graphics drivers. It happens because Chromium and Electron applications default to running through XWayland (the X11 backward compatibility layer). When fractional scaling is active, the Wayland compositor renders XWayland apps at a higher integer resolution and scales them back down like a bitmap image.
Here is how to force Electron and Chromium apps to run natively on Wayland with crisp, pixel-perfect text rendering.
The Magic Fix: Ozone Platform Flags
Chromium and modern Electron (versions 28+) include built-in support for Wayland via the Ozone abstraction layer. You simply need to instruct the application to prefer Wayland over X11:
1
--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations
1. Fix VS Code Permanently
You don’t need to modify .desktop launcher files every time VS Code updates. VS Code includes a persistent runtime configuration file.
- Open VS Code.
- Open the Command Palette (
Ctrl + Shift + P). - Type and select: Preferences: Configure Runtime Arguments (this opens
~/.vscode/argv.json). - Add the following key-value pairs:
1
2
3
4
{
"ozone-platform": "wayland",
"enable-features": "WaylandWindowDecorations"
}
- Save the file and restart VS Code. Your text, sidebar icons, and terminal will immediately render with native HiDPI clarity.
2. Set Global Environment Variable for All Electron Apps
Starting with Electron 28, apps check for the ELECTRON_OZONE_PLATFORM_HINT environment variable. Setting this globally enables native Wayland for any compliant Electron app automatically.
Create or edit your user environment configuration:
1
2
mkdir -p ~/.config/environment.d
nano ~/.config/environment.d/wayland-electron.conf
Add the following line:
1
ELECTRON_OZONE_PLATFORM_HINT=auto
Log out and log back in to activate the variable.
3. Fix Flatpak Apps (Discord, Spotify, Obsidian, Slack)
Flatpaks run inside sandboxes that often block direct access to the Wayland display socket by default, forcing them back to XWayland.
Option A: Using Flatseal (GUI)
- Open Flatseal (install from Flathub if not present:
flatpak install flathub com.github.tchx84.Flatseal). - Select your application (e.g., Discord or Spotify).
- Scroll to Socket:
- Enable Wayland windowing system (
wayland). - Disable X11 windowing system (
x11) if you want to force pure Wayland.
- Enable Wayland windowing system (
- Scroll to Environment:
- Click
+and add:ELECTRON_OZONE_PLATFORM_HINT=auto.
- Click
Option B: Terminal Command Overrides (CLI)
Apply the override directly via terminal:
1
2
3
4
5
6
7
8
# For Discord
flatpak override --user --socket=wayland --env=ELECTRON_OZONE_PLATFORM_HINT=auto com.discordapp.Discord
# For Spotify
flatpak override --user --socket=wayland --env=ELECTRON_OZONE_PLATFORM_HINT=auto com.spotify.Client
# For Obsidian
flatpak override --user --socket=wayland --env=ELECTRON_OZONE_PLATFORM_HINT=auto md.obsidian.Obsidian
4. Fix Google Chrome, Brave, and Microsoft Edge
Chromium browsers can read persistent launch flags from a dedicated config file in your user directory.
Create the matching flags file for your browser:
For Google Chrome:
1
echo "--ozone-platform-hint=auto" >> ~/.config/chrome-flags.conf
For Brave Browser:
1
echo "--ozone-platform-hint=auto" >> ~/.config/brave-flags.conf
For Chromium:
1
echo "--ozone-platform-hint=auto" >> ~/.config/chromium-flags.conf
Restart your browser.
How to Verify Native Wayland Execution
To confirm an application is running natively under Wayland rather than through XWayland:
- Open a terminal and run:
1
xlsclients
- If the application is absent from
xlsclientsoutput, it is running natively on Wayland. - If it appears in
xlsclients, it is still routing through XWayland.
Alternatively, in GNOME, press Alt + F2, type lg (Looking Glass), go to Windows, and verify that the target application has Window type: Wayland rather than X11.
