Skip to content

Instantly share code, notes, and snippets.

@davidedmundson
Last active May 9, 2024 09:35
Show Gist options
  • Star 93 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save davidedmundson/8e1732b2c8b539fd3e6ab41a65bcab74 to your computer and use it in GitHub Desktop.
Save davidedmundson/8e1732b2c8b539fd3e6ab41a65bcab74 to your computer and use it in GitHub Desktop.
Run plasma from within gamescope
#!/bin/sh
# Remove the performance overlay, it meddles with some tasks
unset LD_PRELOAD
## Shadow kwin_wayland_wrapper so that we can pass args to kwin wrapper
## whilst being launched by plasma-session
mkdir $XDG_RUNTIME_DIR/nested_plasma -p
cat <<EOF > $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper
#!/bin/sh
/usr/bin/kwin_wayland_wrapper --width 1280 --height 800 --no-lockscreen \$@
EOF
chmod a+x $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper
export PATH=$XDG_RUNTIME_DIR/nested_plasma:$PATH
dbus-run-session startplasma-wayland
rm $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper
@roel0064
Copy link

I found a reddit post that solves my copy paste issue:
https://www.reddit.com/r/SteamDeck/comments/zqgx9g/desktop_mode_within_gaming_mode_updated_for_new/

Might be of interest to any of you.

I've changed it up a little to add the dynamic resolution functionality from my previous comment:

#!/bin/sh

# Remove the performance overlay, it meddles with some tasks
unset LD_PRELOAD

# Get screen resolution
X=$(xdpyinfo -display :0 | awk '/dimensions/{print $2}' | cut -d 'x' -f1)
Y=$(xdpyinfo -display :0 | awk '/dimensions/{print $2}' | cut -d 'x' -f2)

rm -rf /tmp/desktop-mode
mkdir -p /tmp/desktop-mode
cat > /tmp/desktop-mode/kwin_wayland_wrapper << EOF
#!/bin/sh
$(which kwin_wayland_wrapper) --width $X --height $Y --no-lockscreen --x11-display $DISPLAY \$@
EOF
chmod +x /tmp/desktop-mode/kwin_wayland_wrapper

kwriteconfig5 --file startkderc --group General --key systemdBoot false
PATH=/tmp/desktop-mode:$PATH startplasma-wayland
kwriteconfig5 --file startkderc --group General --key systemdBoot --delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment