this post was submitted on 14 Jun 2024
48 points (96.2% liked)

Linux

48624 readers
1681 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I am aware of the switches you can pass to each app to make it use native wayland, but is there any way to do it globally?

top 21 comments
sorted by: hot top controversial new old
[–] [email protected] 14 points 6 months ago (1 children)

You mean Electron?

The Arch wiki has docs about that.

For Flatpaks I use the environment variable

ELECTRON_OZONE_PLATFORM_HINT=wayland

See my dotfiles on github.com/boredsquirrel/dotfiles

Same possible for Qt QT_QPA_PLATFORM=wayland

[–] [email protected] 3 points 6 months ago (2 children)

Is there a noticeable benefit to those apps running natively on Wayland vs running through xWayland?

[–] [email protected] 1 points 6 months ago (1 children)

I have not checked this, but as far as I know

  • performance: apps are running on a subset of XOrg and xWayland translates it to Wayland
  • RAM: if you have no XWayland apps anymore you save RAM
  • features: some apps may have more features on XOrg, some may have more on Wayland. OBS on XWayland can record keystrokes, QGis on XWayland has not broken dockable toolbars.
[–] Rustmilian 2 points 6 months ago (1 children)
  • performance: apps are running on a subset of XOrg and xWayland translates it to Wayland

"translates it to Wayland" is not correct, XWayland is an X server that runs on Wayland, not a translation layer.

  • RAM: if you have no XWayland apps anymore you save RAM

True. 👍

  • features: some apps may have more features on XOrg, some may have more on Wayland. OBS on XWayland can record keystrokes, QGis on XWayland has not broken dockable toolbars.

OBS on Wayland can record keystrokes too, it just that Global hotkeys can be problematic on KDE and requires a work around.

[–] [email protected] 1 points 6 months ago (1 children)

an X server that runs on Wayland

So... isnt the X window translated to a Wayland surface?

[–] Rustmilian 1 points 6 months ago* (last edited 6 months ago) (1 children)

It does not "translate" or convert X11 windows, but rather forwards them as is over wayland input devices as Wayland surfaces to the underlying Wayland compositor.
Xwayland server still runs the same code as the regular X server, but relies on the Wayland compositor for presentation and composition of the X11 windows.
"translation" suggests conversion of X11 API calls or other code, which is not happening here.

https://wayland.freedesktop.org/xserver.html

[–] [email protected] 1 points 6 months ago

Interesting, thanks!

[–] Rustmilian 0 points 6 months ago

Yes, you get the usual Wayland benefits and tighter integration with the system. However certain applicants can be a little unstable when doing certain actions.

[–] dinckelman 8 points 6 months ago* (last edited 6 months ago)

Depends on your distribution. Arch packages some electron apps in a way, where they can accept their own flags through a dedicated file. For others, it’s just a plain electron-flags.conf in your ~/.config

I would recommend visiting either the arch wiki, or tour distributions equivalent for details

Keep in mind that this does not apply to CEF apps, as that’s an entirely different framework

[–] [email protected] 6 points 6 months ago

Probably not directly helpful, but Nix packages for Chromium and Electron apps are set up so that you can switch to native Wayland mode globally by setting an environment variable, NIXOS_OZONE_WL=1

I don't know of any global setting that isn't distro-specific.

[–] [email protected] 5 points 6 months ago* (last edited 6 months ago) (1 children)

For electron, if ELECTRON_OZONE_PLATFORM_HINT and electron-flags.conf don't work, you can also add --ozone-platform-hint=wayland to the end of Exec in each .desktop file (also works on Chromium, ~~but not CEF AFAIK~~ and sometimes CEF).

There's also --ozone-platform-hint=auto if you find yourself switching between X11 and Wayland.

[–] [email protected] 3 points 6 months ago

Spotify is CEF, I think, and it works pretty well.

[–] [email protected] 4 points 6 months ago (1 children)

Do you mean Electron apps? I didn't even know you could force them to use Wayland.

[–] [email protected] 3 points 6 months ago (5 children)

Is it bad if they use xwayland?

[–] [email protected] 2 points 6 months ago

Bad is relative. But I have some problems with scaling on a HiDPI display with some Electron apps. I think that might be solved if they were Wayland native.

[–] dinckelman 1 points 6 months ago

Define bad.

If you can run native in wayland, run in native wayland. Your performance will be better, and if you need scaling, scaling is considerably better too

[–] Presi300 1 points 6 months ago

They are kinda choppy, when compared to native Wayland apps and screensharing from an app, running in xwayland doesn't really work...

[–] [email protected] 1 points 6 months ago* (last edited 6 months ago)

If you need fractional scaling, they are unusable blurry. Some screens just need fractional scaling so for those setups it's almost essential to do this.

You need fractional scaling it your resolution is very high compared to the screen size. So something like a 15 inch 1440p screen would need 150% or 125% scaling because 100% is too small, 200% is too large but with anything in between, xwayland apps are blurry af.

[–] [email protected] 0 points 6 months ago (1 children)

Like X11, xwayland is not as secure as a pure Wayland environment but I think it's important to note that hundreds of thousands of desktop Linux users are likely still running X11.

So, in my opinion, it is not ideal to run xwayland but still completely acceptable for most users who don't have special security requirements.

[–] [email protected] 2 points 6 months ago

I still run x11 because some of my apps just don't work on wayland, specifically terminal apps for some reason

[–] Rustmilian 1 points 6 months ago