Re: Trying to run KDE 6 Plasma with Wayland....

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 01 Jul 2024 15:47:41 UTC
Mario Marietto <marietto2008@gmail.com> writes:

> ==> pkg install plasma6-plasma kde6-devel

Drop kde6-devel. It's obsolete and pulls other KDE stuff besides Plasma
like KDE Gear (aka applications) that can be used even on GNOME, XFCE, etc.

> ==> pkg install --glob "plasma6-*"
> ==> pkg install --glob "kf6-*"

Unnecessary: already pulled by plasma6-plasma.

> ==> sysrc seatd_enable="YES"

Plasma cannot use seatd without https://github.com/CTSRD-CHERI/cheribsd-ports/commit/02e468a397ad

> ==> sysrc -f /etc/rc.conf kld_list+="nvidia-modeset nvidia-
> drm linux linux64 i915kms ext2fs mac_priority"

nvidia-drm already loads nvidia-modeset. Moreover, loading
nvidia-modeset before nvidia-drm may not work.

According to https://www.freshports.org/graphics/nvidia-drm-61-kmod#message
you also need "sysctl hw.nvidiadrm.modeset=1"

> export MOZ_ENABLE_WAYLAND=1
> export __NV_PRIME_RENDER_OFFLOAD=1
> export __GLX_VENDOR_LIBRARY_NAME=nvidia
> export XDG_SESSION_TYPE=wayland
> export XDG_RUNTIME_DIR=/tmp/$USER/.xdg
> export CLUTTER_BACKEND=wayland
> export SDL_VIDEODRIVER=wayland
> export LIBGL_DRI3_ENABLE=1
> export XKB_DEFAULT_RULES=evdev
> export QT_QPA_PLATFORM=wayland-egl
> export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
> export BEMENU_BACKEND=wayland
> export WLR_DRM_NO_ATOMIC=1
> export XCURSOR_THEME=whiteglass
> #export QT_QPA_PLATFORMTHEME=qt5ct
> export WLR_NO_HARDWARE_CURSORS=1

Looks like a cargo cult. Not only many of these are default but some may
even break Xwayland support in apps that don't support Wayland natively
yet such as emulators/wine*

> [ -d $XDG_RUNTIME_DIR ] || mkdir -m 700 -p $XDG_RUNTIME_DIR

Manually setting and creating XDG_RUNTIME_DIR is obsolete on FreeBSD >= 14
via pam_xdg(8).

Besides, Plasma uses ConsoleKit2 which overrides XDG_RUNTIME_DIR and (if
the value is same) destroys existing contents. GUI apps started before
Plasma with different XDG_RUNTIME_DIR wouldn't be accessible from within
Plasma and may cause other issues.

> exec dbus-launch --sh-syntax --exit-with-session startplasma-

Plasma requires ConsoleKit2 session, so prepend ck-launch-session
like https://cgit.freebsd.org/ports/tree/x11/plasma5-plasma-workspace/files/startplasma-wayland.sh

> but I get the following errors :
>
> https://ibb.co/VNmW9Wn
> https://ibb.co/Hhd5y0Z
> https://ibb.co/XL1xtLH

Do you have /dev/dri/card0 ? If not debug drm-kmod or nvidia-drm-kmod.
After that check if Wayfire works before going on Plasma journey. DEs
like Plasma are a pinnacle of complexity, so even experienced users can
easily drown in pilot errors.

Plasma/Wayland 6.1.1 works fine for me but I've only tested under Sway.
If standalone Plasma/Wayland fails it's likely due to ConsoleKit2 again.