3 # -*- sh -*- vim: ft=sh sw=4 sts=4
5 # Launches a game. Works both on $1 (an argument) and $0 (the actual name
6 # of the script, presumably a symlink). Takes care of killing troublemaking
7 # games, pausing unclutter, remapping the keyboard, and setting an away
10 pkill -INT `basename $0`-bin
14 [ "$DISPLAY" = "127.0.0.1:7.0" ] && DISPLAY=:1.0
16 for suffix in '_demo' '-demo' 'demo' ''; do
17 [ -x "/usr/games/`basename $0`$suffix" ] && \
18 binary="/usr/games/`basename $0`$suffix"
19 [ -x "/usr/local/bin/`basename $0`$suffix" ] && \
20 binary="/usr/local/bin/`basename $0`$suffix"
23 if [ "`basename $0`" = gamelaunch ]; then
28 pkill -9 `basename $binary`-bin
32 xmodmap "$HOME/.Xmodmap" || xmodmap "$HOME/.xmodmap"
35 if [ "`basename $binary`" = doom3 ]; then
36 xmodmap -e "keysym Super_L = KP_5"
37 xmodmap -e "Keysym Hyper_L = Insert"
38 xmodmap -e "keysym Super_R = KP_Insert"
40 xmodmap -e "keysym Super_L = F13"
41 xmodmap -e "keysym Hyper_L = F14"
42 xmodmap -e "keysym Super_R = F15"
45 tpope activity > "$HOME/.activity.$$.bak"
46 echo "Playing `basename $binary`"|tpope activity -
48 $binary "$@" 2>&1 | tee "$HOME/.`basename $binary`.log"
52 xmodmap "$HOME/.Xmodmap" || xmodmap "$HOME/.xmodmap"
54 #rm -f "$HOME/.activity"
55 #[ -f "$HOME/.activity.$$.bak" ] && mv "$HOME/.activity.$$.bak" "$HOME/.activity"
56 cat "$HOME/.activity.$$.bak"|tpope activity -
57 rm -f "$HOME/.activity.$$.bak"