Wayland: Difference between revisions

Raboof (talk | contribs)
To have wayland work inside of QEMU, you may need to pass "-vga qxl".
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Expansion|Verify accuracy of article}}
{{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 ==
== Checking for Wayland ==
Line 31: Line 35:
=== X and Wayland support ===
=== X and Wayland support ===


* [https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/desktops/gnome/core/mutter/default.nix Mutter] is the default [[GNOME]] Desktop Environment/Compositor.
* [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/default.nix KWin (Plasma)] is the default [[KDE]] Desktop Environment/Compositor.
* [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 ==
== 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}}
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 (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])''


==== Electron and Chromium ====
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.


<!-- 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? -->
==== Declaratively (permanent) ====
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">
===== NixOS =====
environment.sessionVariables.NIXOS_OZONE_WL = "1";
{{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>
</syntaxhighlight>


This allows these applications to run without Xwayland.
== Virtualization ==
To have wayland work inside of [[QEMU]], you may need to pass <code>-vga qxl</code>.
 
== See also ==
 
* [[Xorg]]
 
[[Category:Desktop]]