Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gnome fractional scaling not supported - blurry UI #72759

Closed
LennyPenny opened this issue Apr 23, 2019 · 91 comments
Closed

Gnome fractional scaling not supported - blurry UI #72759

LennyPenny opened this issue Apr 23, 2019 · 91 comments
Assignees
Labels
electron Issues and items related to Electron upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream workbench-electron Electron-VS Code issues

Comments

@LennyPenny
Copy link

  • VSCode Version: 1.34.0-insider
  • OS Version: fedora 30-beta

Steps to Reproduce:

  1. Use gnome fractional scaling on a monitor
  2. Open vs code

Top is vs code file browser, bottom is nautilus launched directly from gnome
image

According to https://gitlab.gnome.org/GNOME/mutter/issues/566 and https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1825625 this is an issue with vs code not having support for fractional scaling.

Is this a problem I should forward to the electron repo or is vs code the right place?

@bpasero bpasero added electron Issues and items related to Electron upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Apr 23, 2019
@bpasero
Copy link
Member

bpasero commented Apr 23, 2019

We are building exploration builds that use a much newer version of our UI framework (Electron version 4.0.x). I wonder if this issue reproduces with one of these builds, could you try? Download:

@bpasero bpasero added the info-needed Issue requires more information from poster label Apr 23, 2019
@LennyPenny
Copy link
Author

Sadly I am on fedora linux and use the .rpm builds, are these available as well?

@carwyn
Copy link

carwyn commented Apr 24, 2019

This issue effects anything that's based on chromium including current Google Chrome.

@LennyPenny are you using Wayland on Fedora 30 by any chance? I'm guessing you are as I believe Gnome 3.32 fractional scaling is only available on Wayland. Anything that has to use XWayland (which I think includes current Chromium) ends up blurry as it's not using optimal scaling compared to toolkits like Gtk and Qt that have native Wayland support.

There is some work on chromium Wayland support, much of it here https://github.com/Igalia/chromium with some already upstream.

Until there is proper fractional scaling support It may be possible to force UI scaling off in chromium and instead use font scaling that would at least not be blurry. Widgets however won't be scaled.

@khvn26
Copy link

khvn26 commented Apr 24, 2019

This Chromium issue needs more visibility, I hope this vscode issue will help to fix it faster.

Chromium Wayland support development is being tracked here: https://bugs.chromium.org/p/chromium/issues/detail?id=578890

I wasn't able to pinpoint what exactly should be fixed in Chromium's behavior on Xwayland, or, perhaps, in Xwayland itself. I hope something may be done with one or the other to mitigate this while proper Wayland support is underway.

EDIT: An Xwayland ticket with some discussion here: https://bugzilla.freedesktop.org/show_bug.cgi?id=93315

@bpasero bpasero removed the info-needed Issue requires more information from poster label Apr 24, 2019
@LennyPenny
Copy link
Author

@carwyn yes, gnome fractional scaling is wayland only, which I am using

@bpasero
Copy link
Member

bpasero commented Oct 9, 2019

We are building exploration builds that use a much newer version of our UI framework (Electron version 6.0.x). I wonder if this issue reproduces with one of these builds, could you try? Download:

@bpasero bpasero added the info-needed Issue requires more information from poster label Oct 9, 2019
@LukeCarrier
Copy link

@bpasero there's no change; see the link @khvn26 already posted above for the upstream Chromium effort: https://bugs.chromium.org/p/chromium/issues/detail?id=578890

@bpasero bpasero added upstream-issue-linked This is an upstream issue that has been reported upstream and removed info-needed Issue requires more information from poster labels Oct 10, 2019
@hedgepigdaniel
Copy link

This is the same underlying issue as #41345

@WhyNotHugo
Copy link

Note that this is not Gnome-specific. It affect any modern Linux system running on Wayland (instead of Xorg).

@pmhoudry
Copy link

Any update on this ? The lack of fractionnal support from vscode under wayland seems like a pretty big deal...

@bpasero bpasero added the workbench-electron Electron-VS Code issues label Oct 17, 2020
@bpasero bpasero removed their assignment Nov 4, 2020
@otaviomad
Copy link

Electron has recently added wayland support and it will probably be shipped with Electron 12 (which should happen in a few weeks if you go by their schedule). As is stated in #109176, VSCode will consume the new binaries when released and this issue will finally go away.

@paidhi
Copy link

paidhi commented Nov 21, 2020

I can’t wait for this annoying issue to finally go away. 4K displays are not a rarity anymore theses days. Especially with Developers and IT engineers. I have switched from Chrome back to Firefox because of this. Wayland is working stable with Fedora+GNOME+fractional-scaling already. The upcoming Fedora 34 will switch also KDE/Plasma’s default to Wayland. This issue is pretty much the last problem keeping me from fully adopting a Linux workstation.
As for the JVM based Jetbrains IDE’s (PyCharm, IntelliJ) - I don’t care anymore about their shortcomings with HiDPI/scaling on Linux because VSCode has become so good.

@theGeekyLad
Copy link

@paidhi Chrome's 87.x builds' Wayland support is quite telling. --enable-features=UseOzonePlatform and --ozone-platform=wayland enables transitory support for Wayland and thankfully super smooth scrolling (missed this on X) with 4k.

Loving it on my XPS 15! Hope Electron's roll out v12 soon.

@fosskers
Copy link

fosskers commented Mar 4, 2021

Electron 12 was recently released.

@Saverio-Angelicola
Copy link

Hello, is there a version of vscode that is available with electron 12 support for native wayland support to download.

@otaviomad
Copy link

otaviomad commented Apr 1, 2021

Hello, is there a version of vscode that is available with electron 12 support for native wayland support to download.

Not yet (at least not officially), but almost there. It seems like I vastly overestimated how soon electron 12 would release. You can check the ongoing PR at #120034.

@Royal-lobster
Copy link

1.56 is on electron 12 but still it looks blurry on wayland fractional scaling.

@adamcstephens
Copy link

You need to pass the CLI args: #109176 (comment)

@cbrnr
Copy link

cbrnr commented Jul 11, 2022

Are you sure that's what the issue is about? I reread the OP and it doesn't mention that this is specific to Wayland. I think there might be several different issues being mixed up here.

@edrex
Copy link

edrex commented Jul 11, 2022

@cbrnr from the first few comments:

@LennyPenny are you using Wayland on Fedora 30 by any chance? I'm guessing you are as I believe Gnome 3.32 fractional scaling is only available on Wayland. Anything that has to use XWayland (which I think includes current Chromium) ends up blurry as it's not using optimal scaling compared to toolkits like Gtk and Qt that have native Wayland support.
@carwyn yes, gnome fractional scaling is wayland only, which I am using

@cbrnr
Copy link

cbrnr commented Jul 11, 2022

Yes, and switching from XWayland to native Wayland solved the issue for me.

@edrex
Copy link

edrex commented Jul 11, 2022

yes and the point is this issue isn't about xwayland, and we're just blowing up the thread with OT comments.

@cbrnr
Copy link

cbrnr commented Jul 12, 2022

@edrex I read the whole thread again, and to me it seems like you (and some others) are having a different problem (crisp menu text, blurry UI). This is not what the OP reported, and many others (including me) could solve their blurry VS Code with the CLI flags (although this is still not working by default, which it should, and I couldn't get the app icon to show up, and GPU drivers seem to play a role as well).

Maybe it would be a good idea to create a new issue on what you're seeing? If you want, I can also open a new issue on providing a setting to switch to Wayland, fix the icon, and maybe do that by default on Wayland. But again, I believe that the original issue is more or less fixed, and you are reporting a new (different) one.

@edrex
Copy link

edrex commented Jul 12, 2022

@cbrnr rereading the thread carefully, I see you are right. The original report is from well before Wayland suppport landed in Electron, and instead it's about when running under xwayland.

The issue I'm seeing seems to be that windows aren't updated with the current output scale: dis+enabling the hidpi display with blurry vscode windows crisps them up. I'm not ready to file but someone can feel free to, or link an upstream issue here.

@cbrnr
Copy link

cbrnr commented Jul 12, 2022

To summarize the fix and remaining issues (VS Code devs might want to follow up, @deepak1556 maybe?):

  • VS Code does not support Wayland out of the box. This leads to blurry UI for scalings ≠ 1 (so even integer scalings like 2 are problematic).
  • Wayland support must be manually enabled with the command line argument --ozone-platform=wayland.
  • Using Wayland, native window decorations are not rendered, so the "window.titleBarStyle": "custom" setting in VS Code has to be enabled. Alternatively, and even better, the flag --enable-features=WaylandWindowDecorations should also be enabled if "window.titleBarStyle": "native".
  • Unfortunately, the app icon is not rendered anymore (at least on GNOME). This needs to be fixed.
  • If the icon issue is fixed, I think Wayland support should be enabled by default when running on Wayland.

@sedax90
Copy link

sedax90 commented Jul 15, 2022

@cbrnr this pr is locked until 2021 #135191 and it should solve all the problems. How can we improve it?

@cbrnr
Copy link

cbrnr commented Jul 15, 2022

Yes, #135191 should fix most problems. Like I said, I think it would be nice if Wayland was enabled by default if running on Wayland. The only remaining issue I see is the missing app icon, but maybe this is just an artifact of the flags that are not properly integrated now. Is anything still missing in this PR?

@kumibrr
Copy link

kumibrr commented Aug 16, 2022

The only way I could fix this is by changing any of the displays' scale. The text will render clear, and then I revert that change and stays clear.

It's not optimal because anytime I open a new vscode window I have to do that scale thing again.

Just got back from vacation, I updated all my packages (fedora 36), vscode to 1.70.1 and this solution stopped working with my monitor setup. I have two monitors, my main 4K display (150% scale) and a 1080p secondary (100% scale). The only way I could solve this is by setting my 1080p scale to 125%.

@ashishlotake
Copy link

ashishlotake commented Sep 21, 2022

I found a work around,

  1. copy the code.desktop, cp /usr/share/applications/code.desktop ~/.local/share/applications
  2. edit Exec=/usr/share/code/code --ozone-platform=wayland --unity-launch %F, my code.desktop file
  3. This will make sure that vscode launch via wayland from desktop launcher icon, you won't get blurry screen
  4. next add this line alias code='code --ozone-platform=wayland' to your ~/.zshrc or ~/.bashrc file.This will ensure that when your run code or code . command from terminal, wayland is used, and won't get blurry screen.
  5. Restart, cause sometime log out doesn't work
  6. You may not see vscode window title bar, so go to setting in vscode, and set the "Window: Title Bar Style": "custom"

@sedax90
Copy link

sedax90 commented Sep 22, 2022

I found a work around,

  1. copy the code.desktop, cp /usr/share/applications/code.desktop ~/.local/share/applications
  2. edit Exec=/usr/share/code/code --ozone-platform=wayland --unity-launch %F, my code.desktop file
  3. This will make sure that vscode launch via wayland from desktop launcher icon, you won't get blurry screen
  4. next add this line alias code='code --ozone-platform=wayland' to your ~/.zshrc or ~/.bashrc file.This will ensure that when your run code or code . command from terminal, wayland is used, and won't get blurry screen.
  5. Restart, cause sometime log out doesn't work
  6. You may not see vscode window title bar, so go to setting in vscode, and set the "Window: Title Bar Style": "custom"

Edit. 20221110

I'm able to use it with Ubuntu 22.10 but with some changes:
Exec=/usr/share/code/code --enable-features=WaylandWindowDecorations --ozone-platform=auto --unity-launch %F

Now the icon is not visibile, I had to change also StartupVMClass:
StartupWMClass=code-url-handler


does not work with ubuntu 22.04

@ashishlotake
Copy link

i am using fedora 36, try launching vscode from terminal, using code . --enable-features=UseOzonePlatform --ozone-platform=wayland.
And also check the .desktop file directory,

@v-tibi
Copy link

v-tibi commented Oct 19, 2022

There's a strange bug which does not happen with other electron apps. When I use a second screen and it is positioned above the primary screen, even if I use the Wayland flag, text is blurry until I reload the window or disable then enable 2nd screen. Flag work fine if 2nd screen is in default position.

@andrsbtrg
Copy link

I found a work around,

1. copy the `code.desktop`, `cp /usr/share/applications/code.desktop ~/.local/share/applications`

2. edit `Exec=/usr/share/code/code --ozone-platform=wayland --unity-launch %F`,  my [code.desktop file](https://pastebin.com/GDt90mkf)

3. This will make sure that vscode launch via wayland from desktop launcher icon, you won't get blurry screen

4. next add this line `alias code='code --ozone-platform=wayland'` to your `~/.zshrc` or `~/.bashrc` file.This will ensure that when your run `code` or `code .` command from terminal, wayland is used, and won't get blurry screen.

5. Restart, cause sometime log out doesn't work

6. You may not see vscode window title bar, so go to setting in vscode, and set the `"Window: Title Bar Style": "custom"`

This worked for me but opening via terminal or app drawer launches 'Visual Studio Code - URL Handler' instead:
image

@deepak1556
Copy link
Contributor

@cbrnr thanks for summarizing the issue thread in #72759 (comment). Wayland support is available in the runtime and as mentioned in this issue thread multiple time, it can be enabled either with

--ozone-platform=wayland

or

--ozone-platform-hint=auto

We cannot add --ozone-platform-hint=auto as default at this time since it is not the default even for Chrome. Hopefully it will be the right default in the Electron runtime moving forward.

Also, known wayland issues in VSCode are tracked in this repo. If there is a issue missing for something you encountered with latest version of VSCode, please file one with repro steps. Thanks for understanding.

@cbrnr
Copy link

cbrnr commented Dec 12, 2022

The duplicate app icon and the missing drop shadow issues should also be fixed before Wayland becomes the default. Are these issues already tracked or should I open new issues?

Chrome at least has a setting to enable Wayland (as opposed to a command line flag), and it doesn't have the duplicate icon issue. Maybe something to consider?

@darkbasic
Copy link

Arch Linux has a setting to enable Wayland on Electron apps as well, it's just a matter of how you package Electron.

@pstorozenko
Copy link

I'm working under Ubuntu 22.04.1 with Gnome 42.5 and VSCode 1.74.0.
If I run in terminal any of

code --enable-ozone --ozone-platform=wayland
code --enable-ozone --ozone-platform=auto
code --enable-features=UseOzonePlatfom --ozone-platform=wayland
code --enable-features=UseOzonePlatfom --ozone-platform=auto

nothing happens, i.e., no window appears, no errors displayed in the terminal.

If I run just code --enable-ozone VS Code starts normally, but is blurred.
Any ideas why vscode doesn't start with those flags?

@cbrnr
Copy link

cbrnr commented Dec 13, 2022

@pstorozenko are you sure you are running Wayland and not X.org?

@pstorozenko
Copy link

pstorozenko commented Dec 13, 2022

I think so
image

edit:
Now I think it is related more to some Electron issue and not VSCode as I just tried running slack and tidal with those flags and I observe the same behavior. Although, brave works correctly with those settings.

@deepak1556
Copy link
Contributor

@cbrnr the app icon issue is tracked in #129953

@v-tibi
Copy link

v-tibi commented Dec 21, 2022

I still have to reload the window as in this previous comment:

There's a strange bug which does not happen with other electron apps. When I use a second screen and it is positioned above the primary screen, even if I use the Wayland flag, text is blurry until I reload the window or disable then enable 2nd screen. Flag work fine if 2nd screen is in default position.

@pstorozenko
Copy link

I (somehow) solved the problem!

For some reason I had to remove vscode installation from snap and install it through deb file. Then flag --ozone-platform=wayland worked without problems.

When I run code-insiders --ozone-platform=wayland --verbose (the error is the same as with code, I have code-insiders still installed through snap) I get the following errors:

[1228/080651.090038:ERROR:http_transport_libcurl.cc(118)] dlopen:/snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libcurl.so)
[1228/080651.090070:ERROR:http_transport_libcurl.cc(118)] dlopen:/snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libcurl-gnutls.so.4)
[1228/080651.090083:ERROR:http_transport_libcurl.cc(118)] dlopen:/snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libcurl-nss.so.4)
[1228/080651.090093:ERROR:http_transport_libcurl.cc(118)] dlopen:/snap/core/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /lib/x86_64-linux-gnu/libcurl.so.4)

Of course I have glibc installed on my machine, but the code installed by snap couldn't see it.

The same solution helped with the slack electron application.
So the issue is still there somewhere, but I hope it will be useful for someone.

@LilXhan
Copy link

LilXhan commented Jan 21, 2023

same problem in fedora look:
Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.
help me :(

@BBaoVanC
Copy link

BBaoVanC commented Jan 21, 2023

There's a strange bug which does not happen with other electron apps. When I use a second screen and it is positioned above the primary screen, even if I use the Wayland flag, text is blurry until I reload the window or disable then enable 2nd screen. Flag work fine if 2nd screen is in default position.

I'm getting this same issue, I'm on sway (wayland) but my two monitors are just side by side. Neither is primary because that's not a thing in wayland

This is even with it running wayland native with these flags:

--ozone-platform-hint=auto
--ignore-gpu-blocklist
--enable-features=VaapiVideoDecoder,VaapiVideoEncoder
--enable-gpu-rasterization
--enable-zero-copy
--disable-gpu-driver-bug-workarounds

@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
electron Issues and items related to Electron upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream workbench-electron Electron-VS Code issues
Projects
None yet
Development

No branches or pull requests