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
@gustakasn0v
Copy link

+1 on the above, which is now more relevant as 3.5.5 has hit the Stable channel https://store.steampowered.com/news/app/1675200/view/5484882897552407488

Since 3.5.5 I also experience a minor UI bug: double-clicking "Return to Gaming Mode" on the KDE desktop doesn't fully work, but instead renders a black screen with 'Steam Menu' and 'Back' icons on the lower left and right corners respectively, instead of opening the shortcut's detail page; pressing B in this screen does take you back to the details page and finishes closing Desktop mode however

@roel0064
Copy link

roel0064 commented Nov 20, 2023

I believe it has something to do with DBus.

For the copy issue I found this probably related bug report: https://bugs.kde.org/show_bug.cgi?id=473733
When copying a file it fails and the clipboard reports this as "Message recipient disconnected from message bus without replying"
Edit: The desktop itself has no copy issue & other file managers like KDE's Index (can be found in Discover) also don't have this issue. When a file is already in the clipboard you can paste it just fine with Dolphin as well. When updating to steam OS 3.5 the entire desktop with its default applications also updated. This included Dolphin.

If I understand it correctly. DBus is also responsible for things like "save as" and "upload" windows. Probably the reason why those don't show up. (goofedub's problem)

Not a clue what is wrong with DBus in combination with the NestedPlasma.sh setup though, but the solution is probably related to this.

@rsn8887
Copy link

rsn8887 commented Nov 30, 2023

Thank you for the script. It seems to work at first glance. However, I was hoping this trick would allow VRR in desktop mode when docked with the official dock. But the adaptive sync option is still missing in the KDE Display Settings, just like with x11. Also, with this trick, the display name is now just shown as X11-0 instead of LG Electronics LG FULL HD.

Is there maybe another trick to specifically enable VRR in Plasma Wayland when docked? Maybe the information that VRR is supported, and which refresh rates are supported is somehow lost with this script?

(The game mode performance menu overlay correctly shows VRR as active, and the slider there shows all refresh rates up to 75 Hz.)

@oars
Copy link

oars commented Jan 9, 2024

Any idea why notifications don't have a proper background when running in this mode. This is the case for action set change notifications.

@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