Bug 463029

Summary: kwin_wayland and su - or: how to point $WAYLAND_DISPLAY to another location as the default?
Product: [Plasma] kwin Reporter: Andreas Hartmann <andihartmann>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: nate
Priority: NOR    
Version First Reported In: 5.26.4   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Andreas Hartmann 2022-12-14 06:09:46 UTC
SUMMARY
***
To be able to run wayland apps in another user context (after su e.g.), the app needs access to $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.
To achieve access to $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY for the su user, the directory rights of $XDG_RUNTIME_DIR must be changed to group rx to get access to $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY for the su user (using chmod or setfacl).

If you do this, the log is spammed with entries like this:
[krunner|kioslave5|dolphin|plsamashell|ksmserver|kded|..] QStandardPaths: wrong permissions on runtime directory /run/user/1000, 0750 instead of 0700

Setting a different $WAYLAND_DISPLAY like /tmp/${USER}_WAYLAND (in /etc/profile.d/) does not work, because plasma wayland session afterwards won't start at all (through sddm e.g.):
(from /.local/share/sddm/wayland-session.log)
------------------------------------------------------------------------------------------
Error: could not determine $DISPLAY.
Error: Can not contact kdeinit5!
org.kde.startup: "kdeinit5_shutdown" () exited with code 255
startplasma-wayland: Shutting down...
startplasmacompositor: Shutting down...
startplasmacompositor: Done.
-------------------------------------------------------------------------------------------

How is it supposed to run wayland apps as another user without spamming the log files?
***


STEPS TO REPRODUCE
1. export WAYLAND_DISPLAY=/tmp/${USER}_wayland in /etc/profile.d/wayland.sh
2. Start wayland session in sddm for the primary user
3. 

OBSERVED RESULT
Wayland session doesn't start.

EXPECTED RESULT
Wayland session should start using wayland display /tmp/${USER}_wayland instead of $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.26.4
(available in About System)
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Comment 1 Nate Graham 2023-01-04 19:20:43 UTC
This isn't a KWin bug or feature request; please direct technical or development-related Wayland-related questions elsewhere, like maybe the Wayland mailing list. Thanks!