Skip to content

Instantly share code, notes, and snippets.

@lunalucadou
Forked from smo0z/ProtonLaunch.sh
Last active July 26, 2024 12:15
Show Gist options
  • Save lunalucadou/132a84d6e5d248847f9e90160f7789d7 to your computer and use it in GitHub Desktop.
Save lunalucadou/132a84d6e5d248847f9e90160f7789d7 to your computer and use it in GitHub Desktop.
Proton Launch Script for Games in any Steam Library Folder
#!/bin/sh
# This is a script that allows you to easily launch Steam apps via Proton
# without going through Steam.
# It also allows you to specify specific libraries, for those who utilize
# multiple Steam library folders.
# Finally, it also makes use of curly braces for variable expansion,
# which is best-practice: https://stackoverflow.com/a/8748880
#
# To use this script:
# 1. Save it somewhere (e.g. ~/Desktop/LaunchMyGame.sh)
# 2. Set the variables below appropriately
# 3. Make it executable (e.g. chmod +x ~/Desktop/LaunchMyGame.sh)
# 4. Run it (e.g. ~/Desktop/LaunchMyGame.sh)
#
##### Unless you know what you're doing, leave these two variables alone: #####
STEAM_HOME="${HOME}/.steam/steam"
STEAM_HOME_APPS_PATH="${STEAM_HOME}/steamapps"
##### You MUST set these variables: #####
# If you need to find a game's ID, just go to the Steam Store and get it
# from the URL (e.g. Baldur's Gate 3's app and game ID, at
# https://store.steampowered.com/app/1086940/Baldurs_Gate_3/,
# would be "1086940").
# These two variables should be the same (and MUST be exported):
export SteamAppId=""
export SteamGameId=""
##### Customize these variables as needed: #####
# Set this to the Proton version in use for the given game:
PROTON_VERSION="Proton - Experimental"
# Because you may have games installed in separate libraries,
# you can specify the fully-qualified path to the SteamLibrary the game is
# installed in here, if different from the default home directory SteamLibrary:
#STEAM_GAME_LIBRARY="/some/other/dir/to/SteamLibrary/"
STEAM_GAME_LIBRARY="${STEAM_HOME}"
# The app name and any subdirectories needed to get to the executable
# (e.g. Baldur's Gate 3 would be "Baldurs Gate 3/Launcher"):
APP_SUBPATH=""
# The executable that launches the game
# (e.g. Baldur's Gate 3 would be "LariLauncher.exe"):
APP_EXEC=""
##### Unless you know what you're doing, leave the rest of these alone: #####
# Fully-qualified Steam apps library path
STEAM_GAME_LIBRARY_APPS="${STEAM_GAME_LIBRARY}/steamapps"
# Application path
APP_PATH="${STEAM_GAME_LIBRARY_APPS}/common/${APP_SUBPATH}"
cd "${APP_PATH}"
# Fully qualified path to application executable
APP_EXEC_FULL_PATH="${APP_PATH}/${APP_EXEC}"
# Steam client path
export STEAM_COMPAT_CLIENT_INSTALL_PATH="${STEAM_GAME_LIBRARY_APPS}"
# Steam compat data path
export STEAM_COMPAT_DATA_PATH="${STEAM_GAME_LIBRARY_APPS}/compatdata/${SteamAppId}"
# Proton path
PROTON_PATH="${STEAM_HOME_APPS_PATH}/common/${PROTON_VERSION}"
# Fully-qualified path to Proton executable
PROTON_EXEC="${PROTON_PATH}/proton"
# Run the game
python "${PROTON_EXEC}" run "${APP_EXEC_FULL_PATH}" --skip-launcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment