Skip to content
Snippets Groups Projects

launch-options: Wrap the GUI so Gamescope will display it on Steam Deck

Merged Simon McVittie requested to merge wip/task602 into main
1 file
+ 38
3
Compare changes
  • Side-by-side
  • Inline
+ 38
3
@@ -32,6 +32,41 @@ log () {
echo "${me-steam-runtime-launch-options}[$$]: $*" >&2 || :
}
# run_like_game [exec] COMMAND ARGS
# Run COMMAND ARGS, but wrap it as if it was the actual game for the
# purposes of systemd resource control, Gamescope metadata and so on.
#
# If the first argument is "exec", replace the shell with the COMMAND
# instead of running it as a subprocess.
run_like_game () {
use_exec=
if [ "$1" = exec ]; then
use_exec=yes
shift
fi
app_id="${STEAM_COMPAT_APP_ID-${SteamAppId-}}"
if [ -n "$app_id" ]; then
if [ -x ~/.steam/root/ubuntu12_32/reaper ]; then
set -- ~/.steam/root/ubuntu12_32/reaper SteamLaunch AppId="$app_id" -- "$@"
else
log "warning: ~/.steam/root/ubuntu12_32/reaper not found"
fi
if [ -x ~/.steam/root/ubuntu12_32/steam-launch-wrapper ]; then
set -- ~/.steam/root/ubuntu12_32/steam-launch-wrapper -- "$@"
else
log "warning: ~/.steam/root/ubuntu12_32/steam-launch-wrapper not found"
fi
else
log "warning: Steam app ID not found in environment"
fi
${use_exec:+exec} "$@"
}
main () {
me="$(readlink -f "$0")"
here="${me%/*}"
@@ -107,7 +142,7 @@ main () {
$result"
fi
~/.steam/root/steam-dialog --error --width=500 --text="$result"
run_like_game ~/.steam/root/steam-dialog --error --width=500 --text="$result"
exit 125
fi
@@ -139,11 +174,11 @@ $result"
text="$result"
fi
"$run" "${STEAM_ZENITY:-zenity}" --error --width 500 --text "$text" || :
run_like_game "$run" "${STEAM_ZENITY:-zenity}" --error --width 500 --text "$text" || :
exit 125
fi
if command_line="$(exec "$script" --command-line-fd=1 "$@")" && [ -n "$command_line" ]; then
if command_line="$(run_like_game exec "$script" --command-line-fd=1 "$@")" && [ -n "$command_line" ]; then
log "info: exec $command_line"
eval "exec $command_line" || exit 125
else
Loading