Last active
December 22, 2025 19:10
-
-
Save NeoTheFox/cd80be9c34a0a3b0455050e823d78b60 to your computer and use it in GitHub Desktop.
Link Steam's Proton prefixes by name for ease of use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| help() { | |
| echo NAME | |
| echo " compatdata.sh - create \"by-game\" symlink folder for every compatdata folder on this machine" | |
| echo | |
| echo SYNOPSIS | |
| echo " compatdata.sh [-h] [-p]" | |
| echo | |
| echo OPTIONS | |
| echo " -p Use protontricks to find all steam and non-steam prefixes" | |
| echo " -h Print this help" | |
| exit 0 | |
| } | |
| while getopts ":hp" o; do | |
| case "${o}" in | |
| h) | |
| help | |
| ;; | |
| p) | |
| export USE_PROTONTRICKS=1 | |
| ;; | |
| *) | |
| help | |
| ;; | |
| esac | |
| done | |
| shift $((OPTIND - 1)) | |
| mapfile -t compatdata_array < <(find / -type d -path "*/steamapps/compatdata" 2>/dev/null) | |
| declare -A protontricks_names | |
| function get_protontricks_names() { | |
| while read -r game; do | |
| local ID="$(echo $game | cut -d ' ' -f 1)" | |
| local NAME="$(echo $game | cut -d ' ' -f 2-)" | |
| protontricks_names+=(["$ID"]="$NAME") | |
| done < <(protontricks -l | awk '/\([0-9]+\)/ { match($0, /\(([0-9]+)\)/, arr); appid = arr[1]; gsub(/ *\([^)]+\) */, "", $0); print appid " " $0 }') | |
| } | |
| [ "$USE_PROTONTRICKS" = "1" ] && get_protontricks_names | |
| function get_name() { | |
| if [ "$USE_PROTONTRICKS" = "1" ]; then | |
| echo ${protontricks_names["$1"]} | |
| else | |
| curl -s "https://store.steampowered.com/api/appdetails?appids=$1" | jq -r '.[].data.name' | |
| fi | |
| } | |
| for dir in "${compatdata_array[@]}"; do | |
| echo "Found: $dir" | |
| [ -d "$dir/by-game" ] || mkdir "$dir/by-game" || exit 1 | |
| mapfile -t pfx_array < <(find $dir -type d -maxdepth 1 -mindepth 1 2>/dev/null) | |
| for pfx in "${pfx_array[@]}"; do | |
| APPID=$(basename $pfx) | |
| [ "$APPID" = "0" ] && continue | |
| [ "$APPID" = "by-game" ] && continue | |
| APPNAME=$(get_name $APPID) | |
| [ "$APPNAME" = "null" ] && continue | |
| [ "$APPNAME" = "" ] && continue | |
| echo $APPID → $APPNAME | |
| [ ! -d "$dir/by-game/$APPNAME" ] && ln -s "$pfx" "$dir/by-game/$APPNAME" | |
| done | |
| done |
Author
NeoTheFox
commented
Dec 18, 2025
via email
If you have more than 200 **installed** games! But yeah, I hear you. I
might start using protontricks to query a VDF file instead, because someone
already asked me to support non-steam games that protontricks can do
somehow!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment