Skip to content

fix: change default ozone platform hint to auto #35630

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vially
Copy link
Contributor

@vially vially commented Sep 9, 2022

Description of Change

As suggested in #35614 (comment), change default value of --ozone-platform-hint flag to auto. This means the Wayland platform will be picked by default in Wayland environments and the X11 platform in Xorg environments.

Applications without proper Wayland support can still force the X11 platform in Wayland environments using the --ozone-platform=x11 (or --ozone-platform-hint=x11) command line flag.

Fixes #30897, #41551

Checklist

Release Notes

Notes: Automatically pick Wayland platform in Wayland environments on Linux.

Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we're deviating from Chromium on this?

@deepak1556
Copy link
Member

@MarshallOfSound currently ozone platform initialization happens before the application JS entry point executes https://github.com/electron/electron/blob/main/shell/browser/electron_browser_main_parts.cc#L220-L221, so the flags --ozone-platform-hint and --ozone-platform cannot be dynamically configured by the applications. Applications have to statically set these values in their desktop file. Although newer distro versions use wayland by default, applications still want to support the older x11 backend, which means they are now setting --ozone-platform-hint=auto as the default flag. Instead of individual application setting this flag, electron could provide this as the default given there is no downside to it.

Chrome does not set a default value for ozone platform https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/about_flags.cc;l=398 not sure why, but atleast it can still allow a dynamic setting since flag values can be read before platform initialization.

@ckerr ckerr force-pushed the default-ozone-platform-hint-auto branch from a65dc48 to fff3819 Compare September 13, 2022 00:52
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Sep 16, 2022
@codebytere codebytere requested a review from ckerr September 21, 2022 11:01
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is consistent with what was discussed in #35614

@ckerr
Copy link
Member

ckerr commented Sep 21, 2022

Pinging @MarshallOfSound for another look as per the Changes Requested

@MarshallOfSound
Copy link
Member

I guess my question / concern here still stands. Why are we deviating from Chromium on this. Are end users going to experience issues that they wouldn't experience launching Chrome?

@vially
Copy link
Contributor Author

vially commented Sep 21, 2022

Are end users going to experience issues that they wouldn't experience launching Chrome?

Chromium provides a UI toggle in chrome://flags which makes it trivial for end users to enable Wayland support, but this toggle does not exist in Electron (nor should it).

One notable difference between Electron and Chromium is that Chromium is an application while Electron is a toolkit1. This means end-users usually have only one Chromium application but many Electron applications so even if such a toggle would exist in Electron, it would still not be a practical solution because it would need to be toggled in every Electron app.

So I would argue that in the current situation end-users are indeed experiencing issues in Electron that they do not experience in Chrome (#30897). #35630 and #35614 would both address this, but so far it looks like this pull-request is the preferred approach.

Footnotes

  1. In a way, in this particular case Electron is more similar to GTK and QT than it is to Chromium and both of those provide a way for setting the platform for all apps using that tookit (e.g.: using GDK_BACKEND environment variable for GTK and QT_QPA_PLATFORM for QT).

@codebytere codebytere added the semver/patch backwards-compatible bug fixes label Sep 22, 2022
@vially
Copy link
Contributor Author

vially commented Mar 5, 2023

I suppose the lack of updates means this pull-request is unlikely to progress until Chromium also changes the default ozone platform value.

If that's the case, would #35614 be accepted as a stop-gap measure in the meantime? @MarshallOfSound

@Thatoo
Copy link

Thatoo commented Apr 4, 2024

Is there any issue or even better PR where it has been requested to Chromium to change default ozone platform hint to auto ?

@GerryT11
Copy link

GerryT11 commented Sep 17, 2024

Are there any news with regard to "fix: change default ozone platform hint to auto"?
As far as I have seen there were not many changes since April 2024 and that there is a review missing by @MarshallOfSound . Thank you!

@clemlesne
Copy link

Would be strongly liked for every Linux desktops users... :)

@Candyhands
Copy link

Is there a genuine issue that this change would cause? As far as I see it, this is an easy change that only has positives. This doesn't affect X11 users, and makes things so much better for Wayland users. Expecting Wayland users to not only know which apps are Electron based, but also having them apply the manual fix to every single one of them just feels like unnecessary work for the user. It's a lot of friction.

If there are genuine issues that this change would create, then that's entirely understandable. And I don't think anybody wants more issues to pop up. But I haven't seen any. It's not likely, but it is possible we reach point where nobody uses X11 anymore, and Chromium still hasn't made this change. Would that still not be enough reason to deviate from Chromium? Because Wayland is simply inevitable in userspace at this point.

@GerryT11
Copy link

Is there a genuine issue that this change would cause? As far as I see it, this is an easy change that only has positives.

To add to Candyhands' comment: Please keep in mind that there are also negatives not making this change. Many Electron applications are directed towards end users who have no clue what start parameters are. They just use the default and thus may see blurry Electron apps that cannot handle 4K properly, with other quirks in window management.

@Axolord
Copy link

Axolord commented Nov 25, 2024

There is at least the issue that chromium does not implement the tablet v2 protocol for wacom tablets etc link. Under xwayland that is not a problem.
Though I don't see that this issue is being worked on.

Here are related issues/pull requests by KDE and GNOME, though they only reinforce that the problem lies within chromium/electron.

Wether this issue justifies the standard usage of xwayland instead of wayland is another discussion, I just wanted to hint to it.

@ReillyBrogan
Copy link

I think you're all barking up the wrong tree here. You should be trying to make the case on the Chromium issue tracker that the Ozone platform should default to auto there. Then that change would be synced to Electron once it's in a released version of Chromium.

@parrenin
Copy link

Do we have a link to the chromium issue?
I could not find it.

@ReillyBrogan
Copy link

Do we have a link to the chromium issue? I could not find it.

I dug through the Chromium issue tracker and was able to find https://issues.chromium.org/issues/40250220 referenced as an internal trial for @google.com users to default to Ozone Auto. Unfortunately it does not seem to be publicly visible so I can't see the results of said trial nor what other blockers may remain. Someone should probably create an issue for defaulting to Ozone auto separately.

@parrenin
Copy link

Digging a bit more, I found the chromium issue:
https://issues.chromium.org/issues/40083534
It has many dependencies, so apparently there is still a relatively long way to go before Wayland can become default in Chromium.

@Thatoo
Copy link

Thatoo commented Nov 30, 2024

No one is barking up. Comparing people to dogs isn't a friendly l'année to tell them you don't care about that they have to say, ask and request. As parrenin shows, the work is "on going" since 2016 without moving forward on Chromium side and there is no reason Electron could not make an independent choice for the time being to offer a better user experience to Wayland Linux users until Chromium decide also to do so. Then when this time will (if it will come) Electron will be able to follow again upstream.

No argument have been given for Electron not being able to make an independent choice from upstream.

So asking for change here is completely as relevant as asking it upstream, hoping for the most caring of its users to make the first move first.

@Candyhands
Copy link

Candyhands commented Nov 30, 2024

I think you're all barking up the wrong tree here. You should be trying to make the case on the Chromium issue tracker that the Ozone platform should default to auto there. Then that change would be synced to Electron once it's in a released version of Chromium.

I somewhat agree. While yes, the ideal solution to this would be Chromium implementing this as the default. I think it's relatively safe to say that the maintainer of Chromium simply doesn't care about about adapting to the standards of the community in the same way that projects like this tend to. Just look at all the various objectively better changes Chromium has refused, such as their choice to deprecate JPEGXL even with major lobbying from companies like Adobe and various media outlets. Or them deprecating Manifest V3.

While it would ideal for this change to happen in Chromium, Chromium simply isn't interested in most feedback from non-Google entities as far as I'm concerned. Hence why it is more reasonable to expect changes in downstream software such as Electron.

@parrenin
Copy link

For those who want to know more about the state of Wayland in Chromium, you can look at this video dating from June 2024:
https://www.youtube.com/watch?v=aRKC7mh_A6A
At the end, they list a few stabilization blockers: drag and drop, tab dragging, fractional and mixed scaling, IME.

@ryanabx
Copy link

ryanabx commented Dec 1, 2024

For those who want to know more about the state of Wayland in Chromium, you can look at this video dating from June 2024: https://www.youtube.com/watch?v=aRKC7mh_A6A At the end, they list a few stabilization blockers: drag and drop, tab dragging, fractional and mixed scaling, IME.

As much as I want electron to be wayland native, I would prefer they go with a strict upgrade without losing features. Unfortunately, it looks like chromium is just not ready. I do appreciate the updates though, it was really frustrating to see no public info on chromium and wayland in a while.

@vially
Copy link
Contributor Author

vially commented Aug 4, 2025

I guess my question / concern here still stands. Why are we deviating from Chromium on this.

Chromium is now using the Wayland Ozone platform on Wayland systems by default: https://chromium-review.googlesource.com/c/chromium/src/+/6819616

@MarshallOfSound Is it now a good time for me to rework this pull-request to do the same in Electron?

@MarshallOfSound
Copy link
Member

Will we not just inherit that change from Chromium as it comes down the pipe? I think that would be the most ideal way of absorbing this change.

@vially
Copy link
Contributor Author

vially commented Aug 4, 2025

Good point. I haven't looked at the code in a long time but I think it might get inherited. But it will probably still require some code cleanups on the Electron side too (e.g.: to get rid of the --ozone-platform-hint flag).

In any case, it might be best to wait until that change lands in Electron to see what it will look like and take it from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch backwards-compatible bug fixes
Projects
None yet