add readme and example

This commit is contained in:
Marco Cawthorne 2022-05-21 14:43:48 -07:00
parent 493b0aab4d
commit 980780665e
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
3 changed files with 95 additions and 9 deletions

36
README.md Normal file
View File

@ -0,0 +1,36 @@
# SteamPlay-Custom
When selecting this tool, the *Steam Client* will launch a different program depending on the AppID.
## Configuration
You can define the program it launches via the **~/.config/steamcustomrc** file. An example is provided in the **example/** directory.
The config syntax is as follows:
`appid:application with parameters`
In the case of Unreal:
`13250:unreal`
Each line contains its an appid and a launch command, separated by a `:` symbol.
Only the first instance of an AppID is recognized.
You can supply as many parameters as you like.
If you'd like to enable the *Steam Client* to append its launch parameters to your target as well, append this:
`appid:application with parameters`**`:parms`**
## Finding out AppIDs
Launch any application in Steam with this tool and you'll get a notification on your desktop. It displays the AppID it is trying to launch.
## History
I wrote a handful of compatibility tools that essentially did the same thing: Use the native version of a program or game.
This basically just streamlines all my previous tools into one.
## LICENSE
CC0

20
example/steamcustomrc Normal file
View File

@ -0,0 +1,20 @@
:70:nuclide -game valve
:220:hl2
:2310:quake:parms
:9040:quake -hipnotic
:9030:quake -rogue
:2320:quake2
:2340:quake2 -game rogue
:2330:quake2 -game xatrix
:2200:quake3
:2350:quake3 +set fs_game missionpack
:9050:doom3
:9070:doom3 +set fs_game d3xp
:793670:tw
:273570:descent
:273580:descent2
:13240:ut
:3970:prey
:2300:woof -iwad doom2.wad
:13250:unreal
:10050:etqw

48
wrapper
View File

@ -1,24 +1,54 @@
#!/bin/sh
#!/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
# env check
if [ "$COMMANDTYPE" = "wait-before-run" ]
then
# client forwards this env to us
STEAM_APPID="$SteamGameId"
# find something valid, first result only
CHECK_GAME=$(grep "$STEAM_APPID:" "$SPC_CFG" | head -n 1)
# 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
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
# run our alternative
RUN_GAME=$(echo "$CHECK_GAME" | cut -d ':' -f 2)
exec $RUN_GAME
# 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