Skip to content

Instantly share code, notes, and snippets.

@brunoais
Forked from thingsiplay/proton
Last active March 3, 2026 13:04
Show Gist options
  • Select an option

  • Save brunoais/575db9912368124d3223784afe20158c to your computer and use it in GitHub Desktop.

Select an option

Save brunoais/575db9912368124d3223784afe20158c to your computer and use it in GitHub Desktop.

Revisions

  1. brunoais revised this gist Mar 25, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proton
    Original file line number Diff line number Diff line change
    @@ -164,5 +164,5 @@ export STEAM_COMPAT_DATA_PATH=$env_dir
    # Make sure the directory exists
    [ -d "$env_dir" ] || (mkdir -p "$env_dir" && echoerr "Proton directory created: $env_dir")
    "$client_dir/steamapps/common/$proton_version/proton" run "$*"
    "$client_dir/steamapps/common/$proton_version/proton" run "$@"
  2. brunoais revised this gist Jul 18, 2021. 1 changed file with 106 additions and 10 deletions.
    116 changes: 106 additions & 10 deletions proton
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/sh
    #!/bin/bash

    # Execute Windows programs with Proton from Steams installation folder, without
    # starting Steam client.
    @@ -35,18 +35,25 @@
    # export PROTONVERSION="Proton 3.16"
    # proton program.exe

    # Folder name of the Proton version found under "steamapps/common/".
    # proton_version="Proton - Experimental"
    # proton_version="Proton 3.16"
    proton_version="Proton - Experimental"
    # Folder name possibilities for the Proton version found under "steamapps/common/".
    possible_proton_versions=( "Proton - Experimental" "Proton 6.3" "Proton 5.0" "Proton 3.16" )

    # Path to installation directory of Steam.
    # Alternate path: "$HOME/.steam/steam"
    client_dir="$HOME/.local/share/Steam"
    # Contains the possibilities on where to find steam
    possible_client_dirs=( "$HOME/.local/share/Steam" "$HOME/.steam/steam" "/var/.steam" "/var/steam" "/var/local/Steam" )


    # Default data folder for Proton/WINE environment. Folder must exist.
    # If the environmental variable PROTONPREFIX is set, it will overwrite env_dir.
    env_dir=$HOME/proton
    # If the environmental variable PROTONPREFIX is set, it will overwrite the value set here.
    # If no directory is found, the last one is created and used
    alternative_env_dirs=( "$HOME/proton" "$HOME/.proton" )

    # Proton logging.
    # Uncomment to activate logging for proton
    # export PROTON_LOG="+timestamp,+pid,+tid,+seh,+debugstr,+module"
    # export PROTON_LOG_DIR="/dev/shm/proton"



    # Proton modes to run
    # run = start target app
    @@ -55,18 +62,107 @@ env_dir=$HOME/proton
    # getnativepath = windows -> linux path
    mode=run

    echoerr() { echo "$@" 1>&2; }

    discover_proton_version () {

    for possible_proton_version in "${possible_proton_versions[@]}"
    do
    for possible_client_dir in "${possible_client_dirs[@]}"
    do
    if [[ -f "$possible_client_dir/steamapps/common/$possible_proton_version/proton" ]]
    then
    client_dir="${client_dir:-$possible_client_dir}"
    proton_version="${proton_version:-$possible_proton_version}"
    echoerr "discover_proton_version:" "$possible_client_dir/steamapps/common/${possible_proton_version}/proton"
    return
    fi

    done
    done

    }

    discover_env_dir () {
    for alternative_env_dir in "${alternative_env_dirs[@]}"
    do

    if [[ -d "$alternative_env_dir" ]]
    then
    echoerr "alternative_env_dir:" "$alternative_env_dir"
    env_dir="$alternative_env_dir"
    return
    fi

    done

    env_dir=${$alternative_env_dir[-1]}
    echoerr "final fallback env dir:" "$env_dir"
    }

    client_dir=
    env_dir=
    proton_version=


    if [[ "$1" =~ ((.*?)/steamapps/common/([^/]+)/) ]]
    then
    app_dir="${BASH_REMATCH[1]}"
    client_dir="${BASH_REMATCH[2]}"
    app_dir_name="${BASH_REMATCH[3]}"
    # get the appid
    app_id=$(grep '"appid"' "$(grep -l "$app_dir_name" "$client_dir/steamapps/"*.acf)" |
    sed -Ee 's/.*?"([0-9]+)".*/\1/g')
    env_dir="$client_dir/steamapps/compatdata/$app_id/"
    echo "$env_dir"
    if [[ ! -d "$env_dir" ]]
    then
    env_dir="${alternative_env_dirs[0]}"
    echoerr "Env dir final fallback"
    fi
    echoerr "Env dir as:" " $env_dir"
    else
    discover_proton_version
    fi
    # ENVIRONMENTAL VARIABLES
    if [ -n "${PROTONPREFIX+1}" ]
    then
    env_dir=$PROTONPREFIX
    elif [ -z $env_dir ]
    then
    discover_env_dir
    fi
    if [ -n "${PROTONVERSION+1}" ]
    then
    proton_version=$PROTONVERSION
    elif [ -z "$proton_version" ] || [ -z "$client_dir" ]
    then
    discover_proton_version
    fi
    # EXECUTE
    export STEAM_COMPAT_CLIENT_INSTALL_PATH=$client_dir
    export STEAM_COMPAT_DATA_PATH=$env_dir
    "$client_dir/steamapps/common/$proton_version/proton" $mode $*
    [[ ! -z "$PROTON_LOG" ]] && echo "$client_dir/steamapps/common/$proton_version/proton" $mode $*
    [[ ! -z "$PROTON_LOG_DIR" ]] && mkdir -p "$PROTON_LOG_DIR"
    # Make sure the directory exists
    [ -d "$env_dir" ] || (mkdir -p "$env_dir" && echoerr "Proton directory created: $env_dir")
    "$client_dir/steamapps/common/$proton_version/proton" run "$*"
  3. @thingsiplay thingsiplay revised this gist Jul 5, 2021. 1 changed file with 44 additions and 19 deletions.
    63 changes: 44 additions & 19 deletions proton
    Original file line number Diff line number Diff line change
    @@ -1,34 +1,51 @@
    #!/bin/sh

    # Run Windows programs through Proton from Steams installation, without
    # starting the main Steam client.
    #
    # Create a directory for the Proton environment to run in. As an example make
    # a folder "proton" in your home and point to it in the "env_dir" variable.
    # Then look in the "steamapps/common/" folder in your Steam installation for
    # available Proton versions to use. Pick one and point the variable
    # "proton_version" to that folder name. Obviously you have to download the
    # Proton version you want to use first from Steam client itself. Then it
    # should be found in this directory. Optionally install this script in a
    # directory that is in your $PATH, so you can run it easily from any place.
    # Execute Windows programs with Proton from Steams installation folder, without
    # starting Steam client.
    #
    # 1. Create a directory for Proton environment to run in. As an example make a
    # folder "proton" in your home directory. This folder must exist in order
    # to make Proton work.
    #
    # 2. Point the variable "env_dir" in this script to that folder or...
    #
    # 3. ... alternatively set the environmenal variable "$PROTONPREFIX" to this
    # folder before running the script. It works similar to the "$WINEPREFIX"
    # from WINE and will have higher priority over "env_dir".
    #
    # 4. Look in your Steam installation folder at "steamapps/common/" folder for
    # available Proton versions. Pick one and point the script variable
    # "proton_version" to this that folder name, in example "Proton 3.16".
    # Note: You have to download a Proton version from Steam first, if none is
    # there yet.
    #
    # 5. Or alternatively set the environmental variable "$PROTONVERSION" to that
    # folder name of Proton version before running the script. It has higher
    # priority over script variable "proton_version".
    #
    # 6. Optionally install/copy this script in a directory that is in your $PATH,
    # so you can run it easily from any place. Or set the default interpreter
    # for .exe files to this script.
    #
    # Usage:
    # proton program.exe
    #
    # or:
    # export PROTONPREFIX="$HOME/proton_316"
    # export PROTONVERSION="Proton 3.16"
    # proton program.exe

    # Folder name of the Proton version found under "steamapps/common/".
    # proton_version="Proton - Experimental"
    # proton_version="Proton 3.16"
    proton_version="Proton - Experimental"

    # Old method:
    # Path to the directory where the actual Proton from Steam is installed in.
    # install_dir="$HOME/.steam/steam/steamapps/common/Proton - Experimental"

    # Path to installation directory of Steam.
    # Alternate path: "$HOME/.steam/steam"
    client_dir="$HOME/.local/share/Steam"

    # Data folder for Proton/WINE environment. Folder must exist.
    # Default data folder for Proton/WINE environment. Folder must exist.
    # If the environmental variable PROTONPREFIX is set, it will overwrite env_dir.
    env_dir=$HOME/proton

    # Proton modes to run
    @@ -38,10 +55,18 @@ env_dir=$HOME/proton
    # getnativepath = windows -> linux path
    mode=run

    # ENVIRONMENTAL VARIABLES
    if [ -n "${PROTONPREFIX+1}" ]
    then
    env_dir=$PROTONPREFIX
    fi

    if [ -n "${PROTONVERSION+1}" ]
    then
    proton_version=$PROTONVERSION
    fi

    # EXECUTE
    export STEAM_COMPAT_CLIENT_INSTALL_PATH=$client_dir
    export STEAM_COMPAT_DATA_PATH=$env_dir
    "$client_dir/steamapps/common/$proton_version/proton" $mode $*

    # Old method:
    #"$install_dir/proton" $mode $*
  4. @thingsiplay thingsiplay revised this gist Jul 5, 2021. 1 changed file with 0 additions and 20 deletions.
    20 changes: 0 additions & 20 deletions proton
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,5 @@
    #!/bin/sh

    # Copyright © 2021 Tuncay D.
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the “Software”), to deal
    # in the Software without restriction, including without limitation the rights
    # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the Software is
    # furnished to do so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in
    # all copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    # SOFTWARE.

    # Run Windows programs through Proton from Steams installation, without
    # starting the main Steam client.
    #
  5. @thingsiplay thingsiplay revised this gist Jul 5, 2021. 1 changed file with 20 additions and 0 deletions.
    20 changes: 20 additions & 0 deletions proton
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,25 @@
    #!/bin/sh

    # Copyright © 2021 Tuncay D.
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the “Software”), to deal
    # in the Software without restriction, including without limitation the rights
    # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the Software is
    # furnished to do so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in
    # all copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    # SOFTWARE.

    # Run Windows programs through Proton from Steams installation, without
    # starting the main Steam client.
    #
  6. @thingsiplay thingsiplay revised this gist Jul 5, 2021. 1 changed file with 20 additions and 5 deletions.
    25 changes: 20 additions & 5 deletions proton
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/usr/bin/zsh
    #!/bin/sh

    # Run Windows programs through Proton from Steams installation, without
    # starting the main Steam client.
    @@ -7,14 +7,26 @@
    # a folder "proton" in your home and point to it in the "env_dir" variable.
    # Then look in the "steamapps/common/" folder in your Steam installation for
    # available Proton versions to use. Pick one and point the variable
    # "install_dir" to that directory. Optionally install this script in a
    # "proton_version" to that folder name. Obviously you have to download the
    # Proton version you want to use first from Steam client itself. Then it
    # should be found in this directory. Optionally install this script in a
    # directory that is in your $PATH, so you can run it easily from any place.
    #
    # Usage:
    # proton ./program.exe
    # proton program.exe

    # Folder name of the Proton version found under "steamapps/common/".
    # proton_version="Proton - Experimental"
    # proton_version="Proton 3.16"
    proton_version="Proton - Experimental"

    # Old method:
    # Path to the directory where the actual Proton from Steam is installed in.
    install_dir="$HOME/.steam/steam/steamapps/common/Proton - Experimental"
    # install_dir="$HOME/.steam/steam/steamapps/common/Proton - Experimental"

    # Path to installation directory of Steam.
    # Alternate path: "$HOME/.steam/steam"
    client_dir="$HOME/.local/share/Steam"

    # Data folder for Proton/WINE environment. Folder must exist.
    env_dir=$HOME/proton
    @@ -27,6 +39,9 @@ env_dir=$HOME/proton
    mode=run

    # EXECUTE
    export STEAM_COMPAT_CLIENT_INSTALL_PATH=$client_dir
    export STEAM_COMPAT_DATA_PATH=$env_dir
    "$install_dir/proton" $mode $*
    "$client_dir/steamapps/common/$proton_version/proton" $mode $*

    # Old method:
    #"$install_dir/proton" $mode $*
  7. @thingsiplay thingsiplay renamed this gist Mar 22, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. @thingsiplay thingsiplay created this gist Mar 22, 2021.
    32 changes: 32 additions & 0 deletions proton.zsh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    #!/usr/bin/zsh

    # Run Windows programs through Proton from Steams installation, without
    # starting the main Steam client.
    #
    # Create a directory for the Proton environment to run in. As an example make
    # a folder "proton" in your home and point to it in the "env_dir" variable.
    # Then look in the "steamapps/common/" folder in your Steam installation for
    # available Proton versions to use. Pick one and point the variable
    # "install_dir" to that directory. Optionally install this script in a
    # directory that is in your $PATH, so you can run it easily from any place.
    #
    # Usage:
    # proton ./program.exe

    # Path to the directory where the actual Proton from Steam is installed in.
    install_dir="$HOME/.steam/steam/steamapps/common/Proton - Experimental"

    # Data folder for Proton/WINE environment. Folder must exist.
    env_dir=$HOME/proton

    # Proton modes to run
    # run = start target app
    # waitforexitandrun = wait for wineserver to shut down
    # getcompatpath = linux -> windows path
    # getnativepath = windows -> linux path
    mode=run

    # EXECUTE
    export STEAM_COMPAT_DATA_PATH=$env_dir
    "$install_dir/proton" $mode $*