Wayland: Difference between revisions
m →Applications: fix: typo |
→Applications: feat: imperative |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 39: | Line 39: | ||
== Applications == | == Applications == | ||
Not all apps support running natively on Wayland. To work around this, | 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 === | |||
Ozone Wayland support in [[Chromium]] and [[Electron]] based applications | 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. | ||
==== 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> | |||
== See also == | == See also == | ||
Latest revision as of 16:20, 17 November 2025
Wayland is a modern display server protocol intended as a replacement for the legacy X11 system.
For additional details, see NixOS Manual: Chapter - Wayland.
Checking for Wayland
To check if you are using Wayland, run the following command
$ echo $XDG_SESSION_TYPE
If wayland is returned, you are running Wayland
Setup
Two things are required for running Wayland: a compatible Display Manager, and a compatible Compositor.
Display Managers
Display Managers are responsible for handling user login.
The following Display Managers support using both X and Wayland protocols
Graphical
- gdm is the GNOME Display Manager.
- sddm is the default Display Manager for KDE. Wayland support is currently experimental.
Text-based
Compositors
For the purposes of this basic overview, a compositor can be thought of as equivalent to an X Desktop Environment.
Wayland Native
- Sway is a i3-like compositor.
- Hyprland the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
X and Wayland support
- Mutter is the default compositor for GNOME Desktop Environment.
- KWin is the default compositor for KDE Desktop Environment.
Applications
Not all apps support running natively on Wayland. To work around this, Xwayland should be enabled.
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 "NIXOS_OZONE_WL" with NIXOS_OZONE_WL=1 (also see commit)
As of NixOS 25.05 ("Warbler"), if XDG_SESSION_TYPE is unset or set to "wayland", chromium and electron apps will default to wayland native. This ignores the DISPLAY environment variable.
Declaratively (permanent)
NixOS
environment.sessionVariables.NIXOS_OZONE_WL = "1";
Imperatively (each time an application is launched)
Example: to launch code (📦︎ vscode)
NIXOS_OZONE_WL=1 code