# $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.
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
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