X-Git-Url: http://git.tpope.net/?a=blobdiff_plain;f=bin%2Fgamelaunch;h=0ddbf695f7705436067f08dda35b0d8fb464e7ed;hb=7836a33bfac21cce90ab32169b066b52ba719407;hp=aaa0c515b81cad48ee7a6ca80a8c83896dd355e3;hpb=6d3296dbcaf824fed68a80348847949270b1770b;p=tpope-extra.git diff --git a/bin/gamelaunch b/bin/gamelaunch index aaa0c51..0ddbf69 100755 --- a/bin/gamelaunch +++ b/bin/gamelaunch @@ -1,7 +1,8 @@ #!/bin/sh -# Author: Tim Pope +# $Id$ +# -*- sh -*- vim: ft=sh sw=4 sts=4 -# Launches a game. Works both on $1 (an argument) and $0 (the actually name +# Launches a game. Works both on $1 (an argument) and $0 (the actual name # of the script, presumably a symlink). Takes care of killing troublemaking # games, pausing unclutter, remapping the keyboard, and setting an away # message. @@ -10,26 +11,13 @@ pkill -INT `basename $0`-bin pkill -INT ut2003-bin pkill -INT ut2004-bin sleep 1 -pkill -9 `basename $0`-bin -sync [ "$DISPLAY" = "127.0.0.1:7.0" ] && DISPLAY=:1.0 -#[ -f "$HOME/.activity" ] && mv "$HOME/.activity" "$HOME/.activity.$$.bak" -tpope activity > "$HOME/.activity.$$.bak" -#echo "Playing `basename $0`" > "$HOME/.activity" -echo "Playing `basename $0`"|tpope activity - - -setxkbmap us -xmodmap "$HOME/.Xmodmap" || xmodmap "$HOME/.xmodmap" -pkill -STOP unclutter - -xmodmap -e "keysym Super_L = F13" -xmodmap -e "keysym Hyper_L = F14" -xmodmap -e "keysym Super_R = F15" - for suffix in '_demo' '-demo' 'demo' ''; do + [ -x "/usr/games/`basename $0`$suffix" ] && \ + binary="/usr/games/`basename $0`$suffix" [ -x "/usr/local/bin/`basename $0`$suffix" ] && \ - binary=/usr/local/bin/`basename $0`$suffix + binary="/usr/local/bin/`basename $0`$suffix" done if [ "`basename $0`" = gamelaunch ]; then @@ -37,6 +25,26 @@ if [ "`basename $0`" = gamelaunch ]; then shift fi +pkill -9 `basename $binary`-bin +sync + +setxkbmap us +xmodmap "$HOME/.Xmodmap" || xmodmap "$HOME/.xmodmap" +pkill -STOP unclutter + +if [ "`basename $binary`" = doom3 ]; then + xmodmap -e "keysym Super_L = KP_5" + xmodmap -e "Keysym Hyper_L = Insert" + xmodmap -e "keysym Super_R = KP_Insert" +else + xmodmap -e "keysym Super_L = F13" + xmodmap -e "keysym Hyper_L = F14" + xmodmap -e "keysym Super_R = F15" +fi + +tpope activity > "$HOME/.activity.$$.bak" +echo "Playing `basename $binary`"|tpope activity - + $binary "$@" 2>&1 | tee "$HOME/.`basename $binary`.log" pkill -CONT unclutter