This repository has been archived on 2020-12-25. You can view files and clone it, but cannot push or open issues or pull requests.
game_library/update_steam_library

29 lines
831 B
Bash
Executable File

#!/bin/sh
# Generates scripts to run steam games.
STEAM=$HOME/.local/share/Steam # Steam directory
APPS=$STEAM/steamapps
LIBRARY=$HOME/games/launchers/ # Directory for scripts to go in
if [ ! -d $LIBRARY ]
then
mkdir $LIBRARY
else
rm $LIBRARY/*_steam
fi
for f in $APPS/*.acf
do
ID=$(cat $f | awk '/\t"appid".+/ {print $2}' | tr -d '"')
NAME=$(cat $f | grep '"name"'| cut -d' ' -f3- | tr -d '"') # Game name straight from steam
if echo $NAME | grep 'Proton ' > /dev/null || echo $NAME | grep 'Steamworks' || echo $NAME | grep 'Runtime' # Skip non-game things
then
echo "Skipping $NAME"
else
FN=$(echo $NAME | sed "s/[:!+™'\./]//g" | sed 's/ /_/g') # Clean out all the stuff I don't want in filenames
P=$LIBRARY/${FN}_steam
echo "#!/bin/sh" > $P
echo "steam-native steam://run/$ID" >> $P
chmod +x $P
fi
done