#!/usr/bin/bash IMAGE_INFO="/usr/share/ublue-os/image-info.json" IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO) DECK_OPTION="" if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" ]]; then if [ ! -d $HOME/.local/share/Steam ]; then # Set up steam with the bootstrap before starting it, this allows steam to run for the first time even with no network access if [[ -f "/usr/share/gamescope-session-plus/bootstrap_steam.tar.gz" ]]; then mkdir -p ~/.local/share tar xf /usr/share/gamescope-session-plus/bootstrap_steam.tar.gz -C ~/.local/share fi fi # Install Bazzite's Steam Game Mode Startup & Suspend Videos mkdir -p $HOME/.local/share/Steam/config/uioverrides/movies if [ ! -f $HOME/.local/share/Steam/config/uioverrides/movies/deck_startup.webm ]; then cp /usr/share/ublue-os/bazzite/bazzite.webm $HOME/.local/share/Steam/config/uioverrides/movies/deck_startup.webm fi if [ ! -f $HOME/.local/share/Steam/config/uioverrides/movies/deck-suspend-animation.webm ]; then cp /usr/share/ublue-os/bazzite/bazzite-suspend.webm $HOME/.local/share/Steam/config/uioverrides/movies/deck-suspend-animation.webm fi if [ ! -f $HOME/.local/share/Steam/config/uioverrides/movies/deck-suspend-animation-from-throbber.webm ]; then cp /usr/share/ublue-os/bazzite/bazzite-suspend.webm $HOME/.local/share/Steam/config/uioverrides/movies/deck-suspend-animation-from-throbber.webm fi # Required to maintain the Steam update branch between desktop & Steam Game Mode DECK_OPTION="-steamdeck" elif [ -f $HOME/.local/share/Steam/ubuntu12_32/steamui.so ]; then # Make sure Steam has been successfully started at least once. This is needed for desktop images that don't use a bootstrap archive # Apply Steam Download Speed Fix if not already applied if [ ! -f $HOME/.local/share/Steam/steam_dev.cfg ]; then bash -c 'printf "@nClientDownloadEnableHTTP2PlatformLinux 0\n@fDownloadRateImprovementToAddAnotherConnection 1.0\n" > $HOME/.local/share/Steam/steam_dev.cfg' fi fi switcheroo_state="$(switcherooctl list)" DGPU_OPTION="" # If we're running this on a dGPU in a multi-gpu AMD/Intel system, apply a workaround for the blank Steam window bug if [[ $(echo "${switcheroo_state}" | grep -o 'Device:' | wc -l) -gt 1 ]]; then # TODO: Check if -system-composer is needed with nvidia >=555 driver if ! grep -Pq 'Name:\s+NVIDIA' <<< "$switcheroo_state"; then DGPU_OPTION="-system-composer" fi fi unset -v switcheroo_state if [[ "$XDG_SESSION_TYPE" == "wayland" ]]; then # https://github.com/Supreeeme/extest # Extest is a drop in replacement for the X11 XTEST extension. # It creates a virtual device with the uinput kernel module. # It's been primarily developed for allowing the desktop functionality # on the Steam Controller to work while Steam is open on Wayland. # Also supports Steam Input as a whole. env LD_PRELOAD=/usr/lib/extest/libextest.so /usr/bin/steam "$DECK_OPTION" "$DGPU_OPTION" "$@" else /usr/bin/steam "$DECK_OPTION" "$DGPU_OPTION" "$@" fi