Skip to content

Instantly share code, notes, and snippets.

@trenton4k
Forked from frostworx/STLsetDefault.sh
Created September 8, 2020 02:46
Show Gist options
  • Save trenton4k/b89e8ee9c48a5a0d34b2f7d872edd878 to your computer and use it in GitHub Desktop.
Save trenton4k/b89e8ee9c48a5a0d34b2f7d872edd878 to your computer and use it in GitHub Desktop.
little script to set stl as default starter for every steam game. works with a copy of the steam config
#!/bin/bash
YOURID=0
SUD="$HOME/.steam/steam/userdata/"
LCVDFO="$SUD/$YOURID/config/localconfig.vdf"
LCVDF="/tmp/localconfig.vdf"
LOPT="\\\t\t\t\t\t\t\"LaunchOptions\" \"stl %command%\""
if [ -n "$1" ]; then
if [ -f "$SUD/$1/config/localconfig.vdf" ]; then
echo "argument1 $1 seems to be your steamID"
YOURID="$1"
LCVDFO="$SUD/$YOURID/config/localconfig.vdf"
else
echo "argument1 $1 doesn't seem to be your steamID - $SUD/$1/config/localconfig.vdf does not exist!"
fi
fi
if [ "$YOURID" -eq 0 ]; then
echo "you have to edit YOURID first, to match the directory name of your steamID or provide it as commandline argument 1- exit"
echo "maybe:"
find "$SUD" -maxdepth 1 -type d -name "[1-9]*"
exit 1
fi
if [ ! -f "$LCVDF" ]; then
echo "$LCVDF doesn't exist - copying the original"
if [ ! -f "$LCVDFO" ]; then
echo "$LCVDFO doesn't exist as well - giving up"
exit 1
else
cp "$LCVDFO" "$LCVDF"
fi
fi
sed -i '/LaunchOptions/d' "$LCVDF"
sed -i '/"Playtime"/i '"$LOPT"'' "$LCVDF"
echo "done - you might want to check if the file $LCVDF looks valid before using it!"
echo "make sure to close steam before copying the file!"
echo "create a backup of your unmodified $LCVDFO f.e. with this command:"
echo "cp $LCVDFO $LCVDFO.bak"
echo "if you dare update to the modified stl version with this command (you at your own risk!):"
echo "cp $LCVDF $LCVDFO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment