Created
July 26, 2025 17:45
-
-
Save TiZ-HugLife/213de18dafdc85f891646ca111eb6c65 to your computer and use it in GitHub Desktop.
SteamOS Nested Desktop script with fixes for ValveSoftware/SteamOS#2063 and ValveSoftware/SteamOS#1820
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
# Remove the performance overlay, it meddles with some tasks. | |
unset LD_PRELOAD | |
# Unset various XDG variables set by gamescope; allows portals to work. | |
unset XDG_DESKTOP_PORTAL_DIR XDG_SEAT_PATH XDG_SESSION_PATH | |
# Use the home directory as the starting directory instead of the default | |
# of `./`, which resolves to one of Steam's data directories. | |
cd "$HOME" | |
cleanup () { | |
# Flush fuse mounts beneath here. | |
umount --recursive "$NEW_XDG_RUNTIME_DIR" || true | |
rm -Rf "$NEW_XDG_RUNTIME_DIR" | |
} | |
# Create a new XDG_RUNTIME_DIR. | |
NEW_XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR/nested_plasma | |
trap cleanup EXIT | |
cleanup | |
mkdir "$NEW_XDG_RUNTIME_DIR" --mode 0700 | |
# Some things are (currently) shared, pulseaudio socket needs to be | |
# connected to the main session. | |
mkdir "$NEW_XDG_RUNTIME_DIR/pulse" --mode 0700 | |
ln -s "$XDG_RUNTIME_DIR/pulse/native" "$NEW_XDG_RUNTIME_DIR/pulse/native" | |
ln -s "$XDG_RUNTIME_DIR/pipewire"* "$NEW_XDG_RUNTIME_DIR/." | |
# Grab the resolution that gamescope sets up. | |
res=$(xdpyinfo -display :0 | awk '/dimensions/{print $2}') | |
width=${res%x*}; height=${res#*x} | |
# Shadow kwin_wayland_wrapper so that we can pass args to kwin wrapper | |
# whilst being launched by plasma-session. | |
mkdir "$NEW_XDG_RUNTIME_DIR/bin" | |
cat <<EOF > "$NEW_XDG_RUNTIME_DIR/bin/kwin_wayland_wrapper" | |
#!/bin/sh | |
/usr/bin/kwin_wayland_wrapper \ | |
--width="$width" --height="$height" \ | |
--no-lockscreen "\$@" | |
EOF | |
chmod a+x "$NEW_XDG_RUNTIME_DIR/bin/kwin_wayland_wrapper" | |
export PATH="$NEW_XDG_RUNTIME_DIR/bin:$PATH" | |
export XDG_RUNTIME_DIR="$NEW_XDG_RUNTIME_DIR" | |
dbus-run-session startplasma-wayland |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment