#!/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.
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"}
fi
exec "${HOME:-/root}/.local/share/Steam/steamrtarm64/steam" "$@"
