fix: keep the Steam desktop client in KDE (#610)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-12 06:56:56 -04:00
1 parent 4ec2146019
commit 486032f5db
6 files changed
+176 -18

No files matched your search

+4 -5
View File
@@ -34,9 +34,9 @@ export MOZ_SHM_NO_SEALS=1
# and the KGSL stand-in is not one. Its windows get shm buffers only, so GL programs on it draw with
# Mesa's software rasterizer, Plasma's own Qt Quick draws with Qt's software renderer (plasmashell
# crashes on llvmpipe here), and a Vulkan program cannot draw at all: games and emulators from the
# menu run through droiddeck-gpu (their own gamescope on the app's compositor), and Steam goes back
# to the app as a Steam session - SteamOS's "Return to Gaming Mode". The session's own GL choice
# (zink on Turnip, for the Steam client) is put back by droiddeck-gpu.
# menu run through droiddeck-gpu (their own gamescope on the app's compositor), and Steam's desktop
# client uses software CEF on KDE. The session's own GL choice (zink on Turnip)
# is put back by droiddeck-gpu.
export KWIN_COMPOSE=Q QT_QUICK_BACKEND=software LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe
# mpv refuses that software GL and then fails its X11 fallback (an assertion): allowed it, it plays.
[ -e /etc/mpv/mpv.conf ] || { mkdir -p /etc/mpv && echo gpu-sw=yes >/etc/mpv/mpv.conf; } 2>/dev/null
@@ -61,8 +61,7 @@ chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null
mkdir -p /tmp/.X11-unix /tmp/.ICE-unix && chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix 2>/dev/null
# Fontconfig defaults and Android language fallbacks are set up by droiddeck-session before this
# script or any desktop program starts.
# The menu's "Steam" / "Steam Big Picture" entries and one entry per installed game: all of them
# hand off to the app (droiddeck-steam-launch), since the client cannot draw on this desktop.
# Steam opens on KDE; Steam Big Picture explicitly hands off to the gaming session.
export BL_DESKTOP=1
ln -sf /usr/local/bin/droiddeck-steam-launch /usr/local/bin/steamdeck-steam 2>/dev/null
ln -sf /usr/local/bin/droiddeck-steam-shim /usr/local/bin/steam 2>/dev/null
@@ -355,11 +355,12 @@ reap_orphans() {
# Gamescope's Wayland backend does not forward the outer clipboard into Xwayland.
# This helper owns only Android text selections and exits with this guest session.
if [ -n "${BL_ANDROID_CLIPBOARD:-}" ] && [ -x /usr/local/bin/droiddeck-clipboard ]; then
if [ "${BL_DESKTOP:-}" != 1 ] && [ -n "${BL_ANDROID_CLIPBOARD:-}" ] && [ -x /usr/local/bin/droiddeck-clipboard ]; then
/usr/local/bin/droiddeck-clipboard "$BL_ANDROID_CLIPBOARD" &
fi
start_agent
# KDE already has a session agent; starting another would race its request files.
[ "${BL_DESKTOP:-}" = 1 ] || start_agent
case $mode in
desktop)
@@ -857,9 +858,16 @@ BUSCONF
droiddeck-steam-compat "$steam_root" 2>&1 &
# The client exits 42 when it has updated itself and wants a fresh start (steam.sh does this).
# BL_STEAM_UI=desktop = the client's desktop UI (a window, the library as a list), which the
# desktop's launchers ask for; gamescope shows one window at a time and the game takes over.
# desktop's launchers ask for. KDE owns its windows when BL_DESKTOP=1.
_bl_ui=(-gamepadui)
[ "${BL_STEAM_UI:-}" = desktop ] && _bl_ui=()
_bl_cef=(-cef-force-gpu -cef-use-gl=angle -cef-use-angle=vulkan)
if [ "${BL_DESKTOP:-}" = 1 ] && [ "${BL_STEAM_UI:-}" = desktop ]; then
# KDE uses QPainter/shm on Android. CEF's Vulkan buffers cannot be
# presented there; its software path keeps the library and dialogs on KDE.
_bl_cef=(-cef-disable-gpu)
_bl_ui=(-nobigpicture)
fi
# Deck mode, always outside the desktop UI: -steamdeck is the flag that puts
# the Quick Access Menu and the Deck settings pages on screen; the QAM's performance overlay
# controls stay greyed out without -steamos3, as SteamOS and Armada launch it. -steamos3 makes
@@ -929,7 +937,7 @@ BUSCONF
done
) &
fi
echo "== steam args: ${_bl_ui[*]} ${_bl_cdp[*]} ${_bl_lang[*]} -clientbeta $steam_channel -no-cef-sandbox -cef-force-gpu -cef-ozone-platform=x11 -cef-use-gl=angle -cef-use-angle=vulkan $*"
echo "== steam args: ${_bl_ui[*]} ${_bl_cdp[*]} ${_bl_lang[*]} -clientbeta $steam_channel -no-cef-sandbox -cef-ozone-platform=x11 ${_bl_cef[*]} $*"
# An update that cannot install asks for a restart (rc=42) every time; the count is capped so a
# session can never again loop in silence, which reads as a menu opening and closing by itself.
steam_updates=0
@@ -1020,8 +1028,7 @@ BUSCONF
desktop_ui_pid=$!
fi
"$steam_root/steamrtarm64/steam" "${_bl_ui[@]}" "${_bl_cdp[@]}" "${_bl_lang[@]}" -clientbeta "$steam_channel" \
-no-cef-sandbox -cef-force-gpu -cef-ozone-platform=x11 \
-cef-use-gl=angle -cef-use-angle=vulkan "$@"
-no-cef-sandbox -cef-ozone-platform=x11 "${_bl_cef[@]}" "$@"
rc=$?
if [ -n "$desktop_ui_pid" ]; then
kill "$desktop_ui_pid" 2>/dev/null || true
@@ -4,10 +4,8 @@
# droiddeck-steam-launch desktop [appid|steam-url] Steam's desktop UI, optionally a game
# droiddeck-steam-launch bigpicture [appid|steam-url] Big Picture
#
# The desktop (KDE Plasma) composites in software and has no dma-buf, so the client's own Vulkan
# window - and any game it starts - would die at its first frame there. The request goes to the app
# instead, which ends the desktop and starts a Steam session under gamescope in its place, as
# SteamOS's desktop hands Steam back to Gaming Mode.
# The desktop client stays on KDE's Xwayland. Big Picture is the explicit handoff
# to the app's gaming session.
set -u
ui=${1:-desktop}
target=${2:-}
@@ -20,6 +18,31 @@ case $target in
*) url=steam://rungameid/$target ;;
esac
if [ "$ui" = desktop ] && [ "${BL_DESKTOP:-}" = 1 ]; then
steam_root=${XDG_DATA_HOME:-${HOME:-/root}/.local/share}/Steam
export LD_LIBRARY_PATH=$steam_root/steamrtarm64:$steam_root/steamrtarm64/panorama${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
# A second menu click forwards its URL to Steam's existing instance. Keep only
# one session supervisor, including while the client restarts for an update.
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/droiddeck"
exec 9>"${XDG_CACHE_HOME:-$HOME/.cache}/droiddeck/steam-desktop.lock"
if ! flock -n 9; then
# The supervisor may still be preparing Proton or updating Steam. Invoking
# the binary before its IPC pipe exists would start a competing client.
for ((attempt = 0; attempt < 180; attempt++)); do
pid=$(cat "$HOME/.steam/steam.pid" 2>/dev/null || true)
if [ -p "$HOME/.steam/steam.pipe" ] && [[ "$pid" =~ ^[0-9]+$ ]] && kill -0 "$pid" 2>/dev/null; then
exec "$steam_root/steamrtarm64/steam" -nobigpicture -no-cef-sandbox \
-cef-ozone-platform=x11 -cef-disable-gpu "${url:-steam://open/library}"
fi
sleep 0.5
done
echo "droiddeck-steam-launch: the desktop client did not become ready" >&2
exit 69
fi
export BL_INSIDE=1 BL_STEAM_UI=desktop
exec /usr/local/bin/droiddeck-session steam "${url:-steam://open/library}"
fi
# Ask the app for a Steam session.
dir=${BL_LAUNCH_DIR:-}
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
@@ -1,9 +1,8 @@
#!/bin/bash
# `steam` on the desktop. The client writes a menu entry per installed game that runs
# `steam steam://rungameid/<id>`, and its own launchers say `steam`. On the desktop that goes
# through droiddeck-steam-launch - which runs the client on the desktop itself when it draws with
# the GPU, hands the URL to a client already running there, and asks the app for a Steam session
# on a software desktop. Anywhere else it is the client itself.
# through droiddeck-steam-launch, which keeps the desktop client on KDE and
# hands URLs to a client already running there. Anywhere else it is the client itself.
set -u
if [ "${BL_DESKTOP:-}" = 1 ]; then
url=