Wayland: Difference between revisions

Malix (talk | contribs)
m Applications: enhancements
DHCP (talk | contribs)
m fix formatting
 
(2 intermediate revisions by 2 users not shown)
Line 6: Line 6:


== Checking for Wayland ==
== Checking for Wayland ==
To check if you are using Wayland, run the following command {{Commands|$ echo $XDG_SESSION_TYPE}} If {{ic|wayland}} is returned, you are running Wayland
To check if you are using Wayland, run the following command
<syntaxhighlight lang=console>
$ echo $XDG_SESSION_TYPE
</syntaxhighlight>
If {{ic|wayland}} is returned, you are running Wayland


== Setup ==
== Setup ==
Line 41: Line 45:
Not all apps support running natively on Wayland. To work around this, Xwayland should be enabled. {{Note|Enabling XWayland varies slightly from Compositor to Compositor, and may already be enabled. Consult your Compositor's documentation and/or nix file for how to enable}}
Not all apps support running natively on Wayland. To work around this, Xwayland should be enabled. {{Note|Enabling XWayland varies slightly from Compositor to Compositor, and may already be enabled. Consult your Compositor's documentation and/or nix file for how to enable}}


==== Electron and Chromium ====
=== Electron and Chromium ===
Ozone Wayland (which uses Wayland native instead of Xwayland) support in [[Chromium]] and [[Electron]] based applications can be enabled by setting the environment variable "<code>NIXOS_OZONE_WL</code>" with <code>NIXOS_OZONE_WL=1</code> ''(also see [https://github.com/NixOS/nixpkgs/commit/b2eb5f62a7fd94ab58acafec9f64e54f97c508a6 commit])''
Ozone Wayland (which uses Wayland native instead of Xwayland) support in [[Chromium]] and [[Electron]] based applications can be enabled by setting the environment variable "<code>NIXOS_OZONE_WL</code>" with <code>NIXOS_OZONE_WL=1</code> ''(also see [https://github.com/NixOS/nixpkgs/commit/b2eb5f62a7fd94ab58acafec9f64e54f97c508a6 commit])''


As of NixOS 25.05 ("Warbler"), if <code>XDG_SESSION_TYPE</code> is unset or set to "wayland", [https://issues.chromium.org/issues/40083534#comment599 chromium and electron apps will default to wayland native]. This ignores the <code>DISPLAY</code> environment variable.
As of NixOS 25.05 ("Warbler"), if <code>XDG_SESSION_TYPE</code> is unset or set to "wayland", [https://issues.chromium.org/issues/40083534#comment599 chromium and electron apps will default to wayland native]. This ignores the <code>DISPLAY</code> environment variable.


===== Example =====
==== Declaratively (permanent) ====
 
===== NixOS =====
{{File|3=environment.sessionVariables.NIXOS_OZONE_WL = "1";|name=/etc/nixos/configuration.nix|lang=nix}}
{{File|3=environment.sessionVariables.NIXOS_OZONE_WL = "1";|name=/etc/nixos/configuration.nix|lang=nix}}
==== Imperatively (each time an application is launched) ====
Example: to launch <code>code</code> ''({{Nixpkg|pkgs/applications/editors/vscode/vscode.nix|vscode}})''
<syntaxhighlight lang="console">
$ NIXOS_OZONE_WL=1 code
</syntaxhighlight>
== Virtualization ==
To have wayland work inside of [[QEMU]], you may need to pass <code>-vga qxl</code>.


== See also ==
== See also ==