Jump to content

Wayland: Difference between revisions

From NixOS Wiki
imported>Niahex
Malix (talk | contribs)
m Electron and Chromium: general enhancements
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Expansion|Put 👏 Wayland 👏 howto 👏 here}}
{{Expansion|Verify accuracy of article}}
 
[https://wayland.freedesktop.org/ Wayland] is a modern display server protocol intended as a replacement for the legacy [[Xorg | X11]] system.
 
For additional details, see {{NixOS Manual|anchor=#sec-wayland|name=NixOS Manual: Chapter - 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
 
== Setup ==
 
Two things are required for running Wayland: a compatible Display Manager, and a compatible Compositor.
{{Expansion|Verify completeness of DM and Compositor lists}}
== Display Managers ==
 
Display Managers are responsible for handling user login.
 
The following Display Managers support using both X and Wayland protocols
==== Graphical ====
* [https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/nixos/modules/services/x11/display-managers/gdm.nix gdm] is the [[GNOME]] Display Manager.
* [https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/nixos/modules/services/x11/display-managers/sddm.nix sddm] is the default Display Manager for [[KDE]]. Wayland support is currently experimental.
==== Text-based ====
* [https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/pkgs/applications/display-managers/ly/default.nix ly]
* [https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/pkgs/applications/display-managers/emptty/default.nix emptty]
* [https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/pkgs/applications/display-managers/lemurs/default.nix lemurs]


== Compositors ==
== Compositors ==


For the purposes of this basic overview, a compositor can be thought of as equivalent to an X Desktop Environment. {{Note|It is important to remember that this is not actually the case as there are [https://en.wikipedia.org/wiki/Wayland_(protocol)#Differences_between_Wayland_and_X multiple differences] between how X and Wayland work internally}}
=== Wayland Native ===
* [[Sway]] is a i3-like compositor.
* [[Sway]] is a i3-like compositor.
* [[Hyprland]] Dynamic tiling, tabbed windows, custom renderer.
* [[Hyprland]] the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
 
=== X and Wayland support ===
 
* [https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/desktops/gnome/core/mutter/default.nix Mutter] is the default compositor for [[GNOME]] Desktop Environment.
* [https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/desktops/plasma-5/kwin/default.nix 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. {{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 (which allow these applications to run on Wayland native instead of Xwayland) can be enabled by setting the environment variable "<code>NIXOS_OWONE_WL</code>" with <code>NIXOS_OZONE_WL=1</code>


= Applications =
===== Example =====
{{File|3=environment.sessionVariables.NIXOS_OZONE_WL = "1";|name=/etc/nixos/configuration.nix|lang=nix}}


== Electron and Chromium ==
== See also ==


<!-- I kept getting META error when trying {{ic|NIXOS_OZONE_WL=1}}, and replacing the equals with &equals; didn't work either — does anyone know how to markup this correctly? -->
* [[Xorg]]
As of NixOS 22.05 ("Quokka"), you can enable Ozone Wayland support in [[Chromium]] and [[Electron]] based applications by setting the environment variable <code>NIXOS_OZONE_WL=1</code>. For example, in a {{ic|configuration.nix}}:


<syntaxhighlight lang="nix">
[[Category:Desktop]]
environment.sessionVariables.NIXOS_OZONE_WL = "1";
</syntaxhighlight>

Latest revision as of 12:08, 16 August 2025

☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

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.

☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

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.

Note: It is important to remember that this is not actually the case as there are multiple differences between how X and Wayland work internally

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.

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 (which allow these applications to run on Wayland native instead of Xwayland) can be enabled by setting the environment variable "NIXOS_OWONE_WL" with NIXOS_OZONE_WL=1

Example
❄︎ /etc/nixos/configuration.nix
environment.sessionVariables.NIXOS_OZONE_WL = "1";

See also