Skip to content

Native wayland support with newest electron #109176

Closed

Description

@toger5

Native wayland support would be great to run vs code without XWayland as described in #77752.

Recently electron merged the chrome version with the ozone backend needed:
electron/electron#26022

This would allow for:

  • Kinetic scrolling (maybe this is more elegantly implemented on the elctron side)
  • Better touch support (touch scrolling)
  • better dpi scaling

Activity

  1. deepak1556 commented on Oct 22, 2020

    @deepak1556
    Collaborator

    Thanks for opening the issue, agree with the benefits. The electron PR only got the basic compilation bits, there will be follow-up PRs to make it feature complete. VSCode will consume those binaries once they are available.

    Upstream issue: electron/electron#10915

  2. added
    electron
    linux
    upstream
    upstream-issue-linked
    on Oct 22, 2020
  3. kriive commented on Nov 18, 2020

    @kriive

    Ozone has now landed in stable chrome (87) and in electron 11.0.1! I tried to compile vscode in electron-11.x.x branch, targeting electron 11.0.1. It compiles fine, but if I launch code as follows: code-oss --verbose --log=TRACE --enable-features=UseOzonePlatform --ozone-platform=wayland it shows a window for half a second and then crashes without any log. If I leave out the ozone cli commands vscode starts ok, without crashing.

    EDIT: if I run it through gdb it now segfaults. [Thread 1 "code-oss" received signal SIGSEGV, Segmentation fault.
    0x00005555576c1630 in ?? ()]

  4. tyalie commented on Nov 18, 2020

    @tyalie

    There's also a Wayland debug flag (WAYLAND_DEBUG=1). Maybe you can find more there.

  5. kriive commented on Nov 18, 2020

    @kriive

    Thanks, this is the output given: WAYLAND_DEBUG=1 gdb --args ./code-oss --enable-features=UseOzonePlatform --ozone-platform=wayland
    https://pastebin.com/raw/ALk3JGz6

    This is what happens
    image

  6. vially commented on Nov 21, 2020

    @vially
    Contributor

    As far as I'm aware the official builds for Electron 11 do not have Wayland support. The initial Wayland support (electron/electron#26022) will only land in Electron 12.

    So unless you're using an unofficial Electron build which has backported the Wayland fixes (e.g.: electron-ozone from the AUR) I think it's expected for the build to crash.

  7. deepak1556 commented on Nov 21, 2020

    @deepak1556
    Collaborator

    Valentin Hăloiu (@vially) is correct, the initial experimental support landed only in electron 12, once I merge #110759 to master , the exploration builds of vscode will start using electron 12. Can check again on the crash after that change.

  8. 12101111 commented on Nov 24, 2020

    @12101111

    electron-11 compile from my Gentoo Linux overlay works without any issue ( And works with musl libc! )
    图片

  9. kriive commented on Nov 24, 2020

    @kriive

    Uhm, 韩朴宇 (@12101111) are you launching vscode with --enable-features=UseOzonePlatform --ozone-platform=wayland?

  10. kriive commented on Nov 24, 2020

    @kriive

    Valentin Hăloiu (@vially) is correct, the initial experimental support landed only in electron 12, once I merge #110759 to master , the exploration builds of vscode will start using electron 12. Can check again on the crash after that change.

    Good to know, thank you so much!

    As far as I'm aware the official builds for Electron 11 do not have Wayland support. The initial Wayland support (electron/electron#26022) will only land in Electron 12.

    So unless you're using an unofficial Electron build which has backported the Wayland fixes (e.g.: electron-ozone from the AUR) I think it's expected for the build to crash.

    And thank you for the info!

  11. 12101111 commented on Nov 24, 2020

    @12101111

    Uhm, 韩朴宇 (@12101111) are you launching vscode with --enable-features=UseOzonePlatform --ozone-platform=wayland?

    Yes

  12. 135 remaining items

  13. pbryan commented on Apr 4, 2022

    @pbryan
    [pbryan@sesame ~]$ /opt/visual-studio-code/code --enable-features=UseOzonePlatform --ozone-platform=wayland
    [304926:0404/102527.563331:ERROR:gpu_init.cc(454)] Passthrough is not supported, GL is egl, ANGLE is 
    [304926:0404/102527.567356:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
    Warning: 'enable-features' is not in the list of known options, but still passed to Electron/Chromium.
    Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.
    [304883:0404/102527.615072:ERROR:cursor_loader.cc(116)] Failed to load a platform cursor of type kNull
    [0404/102527.620756:ERROR:elf_dynamic_array_reader.h(64)] tag not found
    [0404/102527.640310:ERROR:directory_reader_posix.cc(42)] opendir /home/pbryan/.config/Code/Crashpad/attachments/0946e5db-6f17-4fa7-a220-d77c8b893670: No such file or directory (2)
    Segmentation fault (core dumped)
    
  14. added
    insiders-released
    and removed
    unreleased
    on Apr 5, 2022
  15. slagiewka commented on Apr 21, 2022

    @slagiewka

    FWIW the Insiders version runs, but starts as LoDPI on a display which has 200% scaling. Using Developer: Reload Window fixes that and it then runs as proper HiDPI window.

    Same is with latest signal-desktop, but for Signal I know of no way to reload it the window...

  16. major-mayer commented on Apr 21, 2022

    @major-mayer
  17. bbx0 commented on Apr 21, 2022

    @bbx0

    Actually on Arch code runs with native wayland using the respective settings. :)

    Version: 1.66.0
    Commit: e18005f0f1b33c29e81d732535d8c0e47cafb0b5
    Date: 2022-04-02T14:00:30.308Z
    Electron: 17.4.0
    Chromium: 98.0.4758.141
    Node.js: 16.13.0
    V8: 9.8.177.13-electron.0
    OS: Linux x64 5.17.3-zen1-1-zen
    
    $ pacman -Q code                                                                                                                                                                                                         
    code 1.66.0-2
    $ cat ~/.config/electron17-flags.conf                                                                                                                                                                                    
    --enable-features=UseOzonePlatform,WaylandWindowDecorations,WebRTCPipeWireCapturer
    --ozone-platform=wayland
    --ozone-platform-hint=auto

    --ozone-platform-hint=auto has currently no effect. I just maintain it for future reference.

  18. major-mayer commented on Apr 21, 2022

    @major-mayer

    Well i don't know what went wrong before, but now for me it also works... Sorry for the spam
    BTW: You don't need UseOzonePlatform anymore. Ozone is the new default since a few Chromium releases.

  19. abraxxa commented on Apr 26, 2022

    @abraxxa

    None of those config files work for me on Ubuntu 22.04 with code 1.66.2. Launching code with --verbose spews so much output it doesn't help me see the problem.
    Any pointers?

  20. RicArch97 commented on Apr 26, 2022

    @RicArch97

    None of those config files work for me on Ubuntu 22.04 with code 1.66.2. Launching code with --verbose spews so much output it doesn't help me see the problem.
    Any pointers?

    If you mean the ~/.config/electron-flags.conf file, that's Arch Linux specific.

  21. abraxxa commented on Apr 26, 2022

    @abraxxa

    Yes, this an the version specific electron17-flags.conf.
    I've tried ~/.config/chrome-flags.conf as well, was ignored as well.

  22. kevindumanoir commented on May 8, 2022

    @kevindumanoir

    I got the same issue as Szymon Łągiewka (@slagiewka) with a 150% scaling. The same issue happens when you relaunch Chrome while keeping active tabs.

  23. noahtallen commented on May 13, 2022

    @noahtallen

    On Fedora 36 + Sway, code --ozone-platform=wayland successfully launches VS Code in Wayland (no need for the other flags), but it seems we are still waiting on #134612 and its PR #135191 for a global configuration.

    One way to work around this is to copy the code.desktop file from /usr/share/applications to ~/.local/share/applications, and set the Exec line to Exec=/usr/share/code/code --ozone-platform=wayland --unity-launch %F. Then Code opens using Wayland when running it via the quick launcher. (Note that the file paths might be different depending on the OS; this is for Fedora.)

    Once Code is already running from an app launcher, the code CLI command will work with Wayland. Even when code ./path/to/dir opens a directory in a new window, that new window runs Wayland as long as you've already opened code from a launcher.

    I don't think this issue is really fixed until VS Code is natively using Wayland by default if it's available.

  24. bacteriostat commented on May 14, 2022

    @bacteriostat

    The flag --ozone-platform-hint needs to be added to electron from chromium (electron/electron#33810) and then electron apps can automatically launch on X11/Wayland based on the current session.

  25. locked and limited conversation to collaborators on May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

electroninsiders-releasedlinuxupstreamupstream-issue-linked

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions