#!/bin/sh
echo "steamos-session-select: $*" >&2
case "${1:-}" in
  ""|gamescope) exit 0 ;;
esac
dir=${BL_LAUNCH_DIR:-}
if [ -z "$dir" ] || [ ! -d "$dir" ]; then
  echo "steamos-session-select: not inside a DroidDeck session (BL_LAUNCH_DIR unset)" >&2
  exit 1
fi
printf 'session=desktop\nui=desktop\nurl=\n' > "$dir/steam-launch.tmp" && mv -f "$dir/steam-launch.tmp" "$dir/steam-launch"
exit 0
