Skip to content

Instantly share code, notes, and snippets.

@pooladkhay
Last active May 10, 2024 05:34
Show Gist options
  • Save pooladkhay/d852ca76f0ca7d4e54d0e2ba786dde25 to your computer and use it in GitHub Desktop.
Save pooladkhay/d852ca76f0ca7d4e54d0e2ba786dde25 to your computer and use it in GitHub Desktop.
VSCode blurry text under Wayland

Source: https://wiki.archlinux.org/title/Visual_Studio_Code#Blurry_text_under_Wayland

Due to Electron issues Visual Studio Code defaults to run under XWayland which may cause blurry text if you're using HiDPI screens.

In order to fix this issue you need to force Electron to run under Wayland by adding --enable-features=UseOzonePlatform --ozone-platform=wayland, for example you'll be launching VSCode like

$ code --enable-features=UseOzonePlatform --ozone-platform=wayland

This fix can be made permanent by creating a .desktop file or by directly editing /usr/share/applications/visual-studio-code.desktop

@sriharshachilakapati
Copy link

This is not working for VSCodium sadly.

చిత్రము

@nufeng1999
Copy link

Unable to enter Chinese!

@spotlesstofu
Copy link

You may want to add WaylandWindowDecorations if you don't see window borders

code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

@homocodian
Copy link

You may want to add WaylandWindowDecorations if you don't see window borders

code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland

How can i make permanent by editing "/usr/share/applications/visual-studio-code.desktop"?

@harsh661
Copy link

To make it permanent, you may want to append --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform=wayland in the code.desktop file in the Exec

@hacefresko
Copy link

I have done this and it works great! However, when starting up the application, it starts as a new Visual Code instance and now I have 2 vscode logos in the task bar. Is there any other wayland flag or something to fix this?

@knoopx
Copy link

knoopx commented Dec 8, 2022

on arch linux you can add these to ~/.config/code-flags.conf and will work for both desktop and command-line invokations

@A7R7
Copy link

A7R7 commented Jan 23, 2023

Seems that it doesn't work for me.
image
my vscode is still blurry, and has window decorations

@spotlesstofu
Copy link

spotlesstofu commented Jan 23, 2023

my vscode is still blurry

Make sure you closed all other instances of code before running the command

@HubKing
Copy link

HubKing commented Feb 24, 2023

This used to work, but recently, it looks blurry in the same way in both Xwayland mode and in Wayland mode. That is, I ran it with code --enable-features=UseOzonePlatform --ozone-platform=wayland, and it looks blurry as Xwayland mode. I am sure it is running in Wayland mode, because IME is not working. When running in Xwayland mode, IME works. What gives? Is there any solution?

PS: I have found the reason... the presence of another monitor with a different DPI. Someone has already opened an issue with that ( microsoft/vscode#174876 ).

@kode54
Copy link

kode54 commented May 11, 2023

I find that if I configure these flags in code-flags.conf, I can't actually open any files with the code terminal command.

Edit: electron running as node, running the Code script, wants a -- after the switches and before any open files.

@KorigamiK
Copy link

I still have a crash on opening with these flags

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