Last active
October 24, 2023 02:06
-
-
Save sonic2kk/dcb878bed0e5eb9bdd87cce80dc22c48 to your computer and use it in GitHub Desktop.
Fetch all Steam Shortcut AppNames from shortcuts.vdf using Bash.
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 | |
# Magic that represents 'AppName' and 'appname' column begin and end | |
# Most of the time (including from Steam itself) this will be 'AppName', but accounts for edge-cases as well | |
magic_appname_camelcase="014170704e616d6500" # 'AppName' | |
magic_appname_lowercase="6170706e616d65" # 'appname' | |
magic_appname_end="0001" # end bytes before next column begins | |
# Paste in your Steam UserID | |
steam_userid="" | |
shortcuts_vdf="$HOME/.steam/root/userdata/${steam_userid}/config/shortcuts.vdf" | |
# Get all Steam Shortcut AppName and appname values (all values between the magic start and end bytes) | |
mapfile -t non_steam_names < <(xxd -p -c 0 "$shortcuts_vdf" | grep -oP "(${magic_appname_camelcase}|${magic_appname_lowercase})\K.*?(?=${magic_appname_end})") | |
# Convert from hex and print in loop with trimmed null byte | |
for i in "${non_steam_names[@]}"; do | |
steam_shortcut_appname="$( printf "%s\n" "$i" | xxd -r -p | tr -d '\0' )" | |
echo "Name: '${steam_shortcut_appname}'" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment