electron: Native Wayland is completely BROKEN in Electron

Preflight Checklist

Electron Version

32.2.1

What operating system(s) are you using?

Ubuntu

Operating System Version

Ubuntu 24.04.1

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

The flags --enable-features=UseOzonePlatform --ozone-platform=wayland or --ozone-platform-hint=wayland --enable-features=WaylandWindowDecorations should open the Electron application in a native wayland window without any issues.

Actual Behavior

The application does not open at all, it will only open in XWayland only. Forcing Native Wayland with any flags such as --enable-features=UseOzonePlatform --ozone-platform=wayland or --ozone-platform-hint=wayland --enable-features=WaylandWindowDecorations will prevent the application from opening.

Testcase Gist URL

No response

Additional Information

Native Wayland is simply not supported in Electron, this has been tested on GNOME Shell 46, if the results are different on other wayland compositor shells or operating systems, please list them below. To test it out, please use the --enable-features=UseOzonePlatform --ozone-platform=wayland or --ozone-platform-hint=wayland --enable-features=WaylandWindowDecorations flags.

This is also why other Electron applications such as VS Code have these issues: https://github.com/microsoft/vscode/issues/207033 https://github.com/microsoft/vscode/issues/231955

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (3 by maintainers)

Most upvoted comments

I’m on a similar hardware config as yours, but cannot get it to work.

olli@amd-subito:~$ ls -al .config/ | grep flags.conf
-rw-r--r--  1 olli olli    96 nov 25 23:01 code-flags.conf
-rw-r--r--  1 olli olli    96 nov 25 23:01 electron-flags.conf

are these files in the correct place?

The env var seems to be correctly set:

olli@amd-subito:~$ echo $ELECTRON_OZONE_PLATFORM_HINT
auto

Just to add some info. Running vscode/chrome without any flag for ozone is impossible here because it freezes a lot, I’m running Ubuntu 24.04.1 LTS with Wayland (because I need the fractional scaling feature). To solve my freezing problems with vscode I created the code-flags.conf and electron-flags.conf with

--ozone-platform-hint=auto
--enable-features=WaylandWindowDecorations
--ozone-platform=wayland

And added the export ELECTRON_OZONE_PLATFORM_HINT=auto to my .zshrc

Same for chrome, switching between profiles, tabs, freezes and crashes a lot, had to define chrome://flags/#ozone-platform-hint to auto.

My machine has 32GB of RAM, Nvidia RTX4060, I9 13gen, so it’s for sure not a lack of resources, something is not right between Electron Apps and Wayland, lot’s of issues on reddit/github about it.

When running the killall -vws2 Xwayland it killed vscode but not chrome.

For me looks like ozone-platform-hint=auto should be the default behavior on electron apps.