Desktop: the Steam and Big Picture launchers run the client on the desktop itself

This commit is contained in:
The412Banner committed 2026-09-24 18:56:24 -04:00
1 parent 42cde57c86
commit 6e69f252f6
4 files changed
+71 -19

No files matched your search

@@ -350,7 +350,8 @@ case $mode in
# The drawer's "Stretch games to fill the screen" works live: the app writes its choice to
# ~/.droiddeck-fill, and each change goes to gamescope as GAMESCOPE_FORCE_WINDOWS_FULLSCREEN on
# the root window, which it watches. What gamescope was started with is where this begins.
(
# Not on the desktop (BL_DESKTOP): no gamescope there, and the loop would outlive the client.
[ -z "${BL_DESKTOP:-}" ] && (
last=${BL_GAMESCOPE_FORCE_FULLSCREEN:-1}
while :; do
sleep 1
@@ -515,7 +516,17 @@ BUSCONF
# The URL arguments were acted on the first time; a restart must not repeat them.
set --
done
reap_orphans
if [ -n "${BL_DESKTOP:-}" ]; then
# Started from the desktop (bannerlator-steam-launch): the desktop's own programs share this
# script's parent, so reap_orphans - right under gamescope, where everything is the client's -
# is not for here. The helpers this run started (the cores and redistributables beats, the
# system bus and the NetworkManager stand-in) go with the client instead.
_bl_jobs=$(jobs -p)
[ -n "$_bl_jobs" ] && kill $_bl_jobs 2>/dev/null
echo "== steam: the client on the desktop has exited"
else
reap_orphans
fi
exit "$rc"
;;
*)
@@ -1,12 +1,18 @@
#!/bin/bash
# Asks the app to start the Steam client, from inside a session (the desktop's menu entries and
# the per-game launchers bannerlator-desktop-games writes):
# Starts the Steam client from inside a session (the desktop's menu entries and the per-game
# launchers bannerlator-desktop-games writes):
# bannerlator-steam-launch desktop [appid|steam-url] Steam's desktop UI, optionally a game
# bannerlator-steam-launch bigpicture [appid|steam-url] Big Picture
# The client cannot run on the desktop: labwc composites in software and offers no dma-buf, so a
# game (or the client's own Vulkan window) would die at its first frame. It runs under gamescope,
# which is a session of its own - so this writes a request into the directory the app watches,
# and the app ends the desktop session and starts a Steam session in its place.
#
# On a desktop that draws with the GPU (labwc on vulkan or gles2 - the default since the GPU
# desktop) the client runs right there: a window on the desktop, through the desktop's Xwayland,
# with the same set-up a Steam session gives it (bannerlator-session steam, minus gamescope), and
# its games open in windows of their own. A client already running there gets the request instead
# of a second one being started.
#
# On a software desktop (pixman: the GPU renderers failed on this device) there is no dma-buf, so a
# game - or the client's own Vulkan window - would die at its first frame. There the request goes
# to the app, which ends the desktop and starts a Steam session under gamescope in its place.
set -u
ui=${1:-desktop}
target=${2:-}
@@ -18,6 +24,30 @@ case $target in
*[!0-9]*) echo "not an app id or steam:// URL: $target" >&2; exit 64 ;;
*) url=steam://rungameid/$target ;;
esac
steam_root=${XDG_DATA_HOME:-${HOME:-/root}/.local/share}/Steam
client=$steam_root/steamrtarm64/steam
if [ "${BL_DESKTOP:-}" = 1 ] && [ -n "${WLR_RENDERER:-}" ] && [ "$WLR_RENDERER" != pixman ]; then
log=${BL_DEBUG_DIR:-$HOME/.cache/droiddeck}/steam-desktop.log
mkdir -p "$(dirname "$log")" 2>/dev/null
if pgrep -f 'steamrtarm64/steam( |$)' >/dev/null 2>&1 && [ -x "$client" ]; then
# One client at a time: the running one takes the request (a second start hands its command
# line over and exits). No game asked for = switch it to the UI that was clicked.
[ -n "$url" ] || { [ "$ui" = bigpicture ] && url=steam://open/bigpicture || url=steam://open/main; }
echo "bannerlator-steam-launch: the client is running on the desktop; handing it $url" | tee -a "$log"
exec "$client" "$url"
fi
echo "bannerlator-steam-launch: starting the Steam client on the desktop ($ui${url:+, $url}); log: $log"
# BL_INSIDE: the session script's Steam start-up without gamescope in front of it. The desktop UI
# unless Big Picture was asked for; never Deck mode (its Quick Access Menu needs gamescope).
export BL_INSIDE=1 BL_STEAMDECK=0
if [ "$ui" = desktop ]; then export BL_STEAM_UI=desktop; else unset BL_STEAM_UI; fi
setsid /usr/local/bin/bannerlator-session steam ${url:+"$url"} >>"$log" 2>&1 < /dev/null &
exit 0
fi
# The software desktop, or outside the desktop: ask the app for a Steam session.
dir=${BL_LAUNCH_DIR:-}
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
echo "bannerlator-steam-launch: not inside a DroidDeck session (BL_LAUNCH_DIR unset)" >&2
@@ -1,12 +1,19 @@
#!/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`; neither can run the client
# here (no dma-buf on the desktop), so on the desktop this hands off to the app for a Steam session
# in the client's desktop UI under gamescope. Anywhere else it is the client itself.
# `steam steam://rungameid/<id>`, and its own launchers say `steam`. On the desktop that goes
# through bannerlator-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.
set -u
if [ "${BL_DESKTOP:-}" = 1 ]; then
url=
for arg in "$@"; do case $arg in steam://*) url=$arg ;; esac; done
exec /usr/local/bin/bannerlator-steam-launch desktop ${url:+"$url"}
ui=desktop
for arg in "$@"; do
case $arg in
steam://*) url=$arg ;;
-gamepadui|-bigpicture) ui=bigpicture ;;
esac
done
exec /usr/local/bin/bannerlator-steam-launch "$ui" ${url:+"$url"}
fi
exec "${HOME:-/root}/.local/share/Steam/steamrtarm64/steam" "$@"