You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.1 KiB

#!/bin/bash
# source our .bashrc if present
if [ -f "$HOME/.bashrc" ]
then
. $HOME/.bashrc
fi
SPC_CFG="$HOME/.config/steamcustomrc"
COMMANDTYPE=$1
if [ "$COMMANDTYPE" = "wait-before-run" ]
then
# client forwards this env to us
STEAM_APPID="$SteamGameId"
# find valid entry, first result only
CHECK_GAME=$(grep ":$STEAM_APPID:" "$SPC_CFG" | head -n 1)
# nothing found? throw a message...
if [ -z "$CHECK_GAME" ]
then
notify-send -a "SteamPlay-Custom" \
-i "steam" "SteamPlay-Custom" \
"AppID $STEAM_APPID has no entry in $SPC_CFG"
exit
fi
# grab our alternative
RUN_GAME=$(echo "$CHECK_GAME" | cut -d ':' -f 3)
# check for empty launch parameter
if [ -z "$RUN_GAME" ]
then
notify-send -a "SteamPlay-Custom" \
-i "steam" "SteamPlay-Custom" \
"No program supplied with AppID in $SPC_CFG"
exit
fi
# check if steam launch parms are allowed
RUN_PARM=$(echo "$CHECK_GAME" | cut -d ':' -f 4)
# run it
if [ "$RUN_PARM" = "parms" ]
then
PARMARR=( "$@" )
ARGLEN=${#PARMARR[@]}
GAMEARGS=${PARMARR[@]:2:$ARGLEN-1}
exec ${RUN_GAME} ${GAMEARGS}
else
exec ${RUN_GAME}
fi
fi