Skip to content

Instantly share code, notes, and snippets.

@alex2844
Created April 30, 2022 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex2844/f54446592ea963fcc818ee03d26e111f to your computer and use it in GitHub Desktop.
Save alex2844/f54446592ea963fcc818ee03d26e111f to your computer and use it in GitHub Desktop.
#!/bin/bash
# sudo apt install icoutils
# wrestool -x --output=./ -t14 ./$EXE
# icotool -x --width=128 --height=128 $(ls -S -1 *.ico | head -n 1)
GAME_EXE=
for arg in "$@"; do
if [[ "$arg" =~ '.exe' ]]; then
GAME_EXE=$arg;
fi
done
if [ ! -z "$GAME_EXE" ]; then
shortcuts=$(cat -v /home/alexsmith2844/.steam/steam/userdata/*/config/shortcuts.vdf | sed "s/\^[@A-Z]/\n/g" | sed "s/\"//g");
readarray -t line < <(printf '%s' "$shortcuts");
for i in "${!line[@]}"; do
if [ "${line[$i]}" == "AppName" ]; then
AppName=${line[$i+1]};
elif [ "${line[$i]}" == "Exe" ]; then
Exe=${line[$i+1]};
elif [ "${line[$i]}" == "StartDir" ]; then
StartDir=${line[$i+1]};
elif [ "${line[$i]}" == "LaunchOptions" ]; then
LaunchOptions=${line[$i+1]};
if [ "$GAME_EXE" == "$Exe" ]; then
if [ ! -z "$StartDir" ] && [ ! -r "$StartDir" ] && [[ "$StartDir" =~ '/media/' ]]; then
if [ ! -z $(type -p udisksctl) ]; then
LabelDisk=$(echo $StartDir | cut -d / -f 4);
udisksctl mount --block-device /dev/disk/by-label/$LabelDisk;
cd $StartDir;
fi
fi
break;
fi
fi
done
fi
RUN_EXEC=();
if [ ! -z $(type -p mangohud) ]; then
RUN_EXEC+=(mangohud);
fi
if [ ! -z $(type -p gamemoderun) ]; then
RUN_EXEC+=(gamemoderun);
fi
exec env "${RUN_EXEC[@]}" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment