Skip to content

Instantly share code, notes, and snippets.

@theandrewbailey
Created December 31, 2025 19:11
Show Gist options
  • Select an option

  • Save theandrewbailey/3205fde064c4c1a17eda7b396a55fd4b to your computer and use it in GitHub Desktop.

Select an option

Save theandrewbailey/3205fde064c4c1a17eda7b396a55fd4b to your computer and use it in GitHub Desktop.
Run EXE in Proton
#! /bin/bash
set -e
readonly b="\033[1m" # bold text
readonly i="\033[3m" # italic text
readonly n="\033[0m" # normal text
readonly r="\033[0;31m" # red text
readonly u="\033[4m" # underlined text
readonly PROTON_ROOT="$HOME/.proton"
readonly STEAM_ROOT="$HOME/.steam/root"
if [[ $1 != -* ]] ; then
readonly GAME_ROOT="$(dirname "$1")"
readonly RUN_EXE=$1; shift
fi
function errorAndExit(){ # message, error code
echo -e "$r$1$n" >&2
exit $2
}
function initializeVars(){
declare -g PROTON_VER="Proton - Experimental"
declare -g LIST_PROTON_VERSIONS=False
}
initializeVars
while getopts 'hlp:w:' opt; do case "$opt" in
h)
initializeVars # reset defaults to clear any argument changes
columns=$(tput cols)
echo -e "${b}NAME$n
withProton.sh - Run EXE in Proton
${b}SYNOPSIS$n
withProton.sh whatever.exe [options...]
withProton.sh -l
${b}DESCRIPTION$n
When you just want to run a random EXE in Proton (and WINE won't work) without having to configure a bunch of options you don't care about in some obscure GUI. Just throw it in and use the defaults.
${b}OPTIONS$n
$b-h$n
Print this help and exit.
$b-l$n
List all installed Proton versions (available in ~/.steam/root/steamapps/common) and exit.
$b-p$n ${i}\"ProtonVersion\"$n
Set the Proton version, default \"$PROTON_VER\"
$b-w$n ${i}\"WineRoot\"$n
By default, there will be one Wine root for each Proton version, but you can specify a different one with this option. These are stored in ~/.proton
${b}ENVIRONMENT$n
Steam must be installed on the local user's home directory at ~/.steam with at least one Proton version.
"|fmt -w $columns
exit 0
;; l)
LIST_PROTON_VERSIONS=True
;; p)
PROTON_VER="$OPTARG"
;; w)
declare -g WINE_ROOT="$OPTARG"
;; \?)
errorAndExit "Bad option: $opt" 2
;; esac done
function checkArgs(){
if [ $LIST_PROTON_VERSIONS = True ] ; then
ls -Q ~/.steam/root/steamapps/common/ | grep --color=never ^\"Proton[[:print:]+]
exit 0
fi
if [[ ! -f $RUN_EXE ]]; then
errorAndExit "No file: $RUN_EXE" 2
fi
if [ ! -d "$STEAM_ROOT/steamapps/common/$PROTON_VER" ]; then
errorAndExit "Proton version not available: $PROTON_VER" 2
fi
}
checkArgs
cd "$GAME_ROOT" || exit
if [[ -z "$WINE_ROOT" ]]; then
declare -g WINE_ROOT="$PROTON_VER"
fi
mkdir -p "$PROTON_ROOT/$WINE_ROOT"
export STEAM_COMPAT_DATA_PATH="$PROTON_ROOT/$WINE_ROOT"
export STEAM_COMPAT_CLIENT_INSTALL_PATH="$STEAM_ROOT"
"$STEAM_ROOT/steamapps/common/$PROTON_VER/proton" run "$RUN_EXE" >/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment