ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3.01k stars 197 forks source link

Consider providing an option (in the CLI) to run gamescope without XWayland support #1424

Open VarLad opened 2 months ago

VarLad commented 2 months ago

This would help running gamescope inside toolbox/distrobox containers without the container having root permissions. As an alternative, a --rootful-xwayland option that uses rootful mode XWayland also works to achieve this. For further reference, look into https://wiki.archlinux.org/title/wayland and https://gitlab.freedesktop.org/ofourdan/xwayland-run/

layercak3 commented 2 months ago

What exactly makes the container require root permissions? Wouldn't rootful xwayland in gamescope just involve running Xwayland under gamescope --expose-wayland and its WAYLAND_DISPLAY?

misyltoad commented 2 months ago

I think there is some misunderstanding here. Rootful isn't anything about needing root permissions, it's about making the root window (ie. the desktop window) an actual window, instead of forwarding the toplevels on top of the desktop.

layercak3 commented 2 months ago

I am well aware of what rootful/rootless xwayland is. I looked up what toolbox/distrobox are (containers with tight host integration, so sharing x/wayland sockets). My first guess would be that they set up the parent directories of their socket mounts in a way that the xserver doesn't like. What does ls -alR /tmp/.X* look like in the container? ~Maybe~ definitely related: https://github.com/containers/toolbox/issues/1480 https://github.com/ValveSoftware/gamescope/issues/1133 https://github.com/89luca89/distrobox/issues/451 (not sure why you say rootful xwayland works, maybe they do behave differently in this regard) If it is related then I think it's a limitation in how distrobox/toolbox is configuring the filesystem and not an issue with gamescope, but you can probably workaround it if you can modify the container configuration or mount over it (see the distrobox issue I linked)

edit: It's not xserver complaining, it's wlroots, so that's why a rootful xwayland launched (with WAYLAND_DISPLAY=gamescope-n) would work, probably xserver doesn't even check. The check is done for good reason because of X sockets being in the shared /tmp and not $XDG_RUNTIME_DIR, so distrobox/toolbox definitely needs to set the owner of those directories as the user in the unprivileged user namespace case like bwrap/flatpak.