Enable Wayland on GNOME/KDE

Description

I can run Hyprland on my machine. This means my machine can support Wayland, at least to some extent. However, only X11 is used by GNOME and KDE, even when Wayland options are enabled.

KDE

Example

{ pkgs, user, ... }: {
	services.xserver = {
		# Required by SDDM.
		enable = true;
		displayManager.sddm = {
			enable = true;
			wayland.enable = true;
		};
		# Enable Desktop Environment.
		desktopManager.plasma5.enable = true;
		# Configure keymap in X11.
		layout = user.services.xserver.layout;
		xkbVariant = user.services.xserver.xkbVariant;
		# Exclude default X11 packages I don't want.
		excludePackages = with pkgs; [ xterm ];
	};
}

Result

Graphics Platform in KDE about setting page still says X11.

GNOME

Example

{ pkgs, user, ... }: {
	services = {
		# Ensure gnome-settings-daemon udev rules are enabled.
		udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
		xserver = {
			# Required for DE to launch.
			enable = true;
			displayManager = {
				gdm = {
					enable = true;
					wayland = true;
				};
			};
			# Enable Desktop Environment.
			desktopManager.gnome.enable = true;
			# Configure keymap in X11.
			layout = user.services.xserver.layout;
			xkbVariant = user.services.xserver.xkbVariant;
			# Exclude default X11 packages I don't want.
			excludePackages = with pkgs; [ xterm ];
		};
	};
}

Result

Windowing System in GNOME about settings page still says X11.

Note

I’ve seen people online say that Wayland will be used if supported by the hardware, but I’ve used Hyprland, so I know my hardware has some level of support for Wayland (although my hardware is very old).

Hardware Information

CPU: AMD FX-8350 x 8
GPU: AMD Radeon R9 290X

Maybe a stupid question, but did you check “Wayland” before starting the session? (bottom left on the screen when you type your password) I have not done anything to install KDE with wayland and I have both options wayland + x11 available at startup. Note that KDE used to suffer from some bugs in Wayland, not sure what is the current status as suggested in:

1 Like

A quick thought (sorry its late)…While I don’tr have wayland.enable = true; I have an extra line on my config:

displayManager = {
  defaultSession = "plasmawayland"; # THIS IS MY DIFFERENCE
  sddm.enable = true;
};

I will look more closely later if this doesn’t help!

This should just change the default session kind to start… but in theory you should be able to select whichever version you prefer in sddm the first time you type your password. At least it is what I have in my system and I don’t have a single line mentionning wayland in my system:

$ cat /etc/nixos/configuration.nix | rg sddm -C 2
  # Enable the KDE Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

if you don’t have anything, maybe try to remove the wayland = true;

Not a stupid question. I had never seen the login screen because I always skip it (I removed that from the example code because I thought it wasn’t relevant). Turns out, I guess Wayland isn’t supported on my hardware. I say this because when I set services.xserver.displayManager.defaultSession = "plasmawayland" it fails to launch any GUI. The same thing occurs when I enable the login screen and select Wayland in the bottom left.

Oh good.

Seems like people managed o use wayland there before, like here Wayland occasionally hanging (mostly with VLC full screen)

so maybe try to run journalctl -e to see more errors. People reported black screen in https://www.reddit.com/r/kde/comments/1216tns/kde_wayland_black_screen_with_new_update/ due to multiple screens not sharing the same refresh rate… guess getting the exact errors will help more.

Don’t understand how Hyprland is working…

That’s why I guess it’s not a hardware problem. Getting the log would certainly help.