Skip to content

Instantly share code, notes, and snippets.

@frostworx
Last active April 25, 2021 03:40
Show Gist options
  • Save frostworx/36bd76e705a0c87af523fa57cfeebaf8 to your computer and use it in GitHub Desktop.
Save frostworx/36bd76e705a0c87af523fa57cfeebaf8 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 '/"Play[Tt]ime"/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"
@Confetti-Camouflage
Copy link

@frostworx Steam seems to use playTime instead of Playtime now for line 38.

@frostworx
Copy link
Author

@Confetti-Camouflage Thanks, should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment