diff --git a/README.md b/README.md new file mode 100644 index 0000000..7df8c6b --- /dev/null +++ b/README.md @@ -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 diff --git a/example/steamcustomrc b/example/steamcustomrc new file mode 100644 index 0000000..fde4a79 --- /dev/null +++ b/example/steamcustomrc @@ -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 diff --git a/wrapper b/wrapper index 0706023..aeb0557 100755 --- a/wrapper +++ b/wrapper @@ -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