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 pkill -9 `basename $0`-bin
16 [ "$DISPLAY" = "127.0.0.1:7.0" ] && DISPLAY=:1.0
18 #[ -f "$HOME/.activity" ] && mv "$HOME/.activity" "$HOME/.activity.$$.bak"
19 tpope activity > "$HOME/.activity.$$.bak"
20 #echo "Playing `basename $0`" > "$HOME/.activity"
21 echo "Playing `basename $0`"|tpope activity -
24 xmodmap "$HOME/.Xmodmap" || xmodmap "$HOME/.xmodmap"
27 xmodmap -e "keysym Super_L = F13"
28 xmodmap -e "keysym Hyper_L = F14"
29 xmodmap -e "keysym Super_R = F15"
31 for suffix in '_demo' '-demo' 'demo' ''; do
32 [ -x "/usr/games/`basename $0`$suffix" ] && \
33 binary="/usr/games/`basename $0`$suffix"
34 [ -x "/usr/local/bin/`basename $0`$suffix" ] && \
35 binary="/usr/local/bin/`basename $0`$suffix"
38 if [ "`basename $0`" = gamelaunch ]; then
43 $binary "$@" 2>&1 | tee "$HOME/.`basename $binary`.log"
47 xmodmap "$HOME/.Xmodmap" || xmodmap "$HOME/.xmodmap"
49 #rm -f "$HOME/.activity"
50 #[ -f "$HOME/.activity.$$.bak" ] && mv "$HOME/.activity.$$.bak" "$HOME/.activity"
51 cat "$HOME/.activity.$$.bak"|tpope activity -
52 rm -f "$HOME/.activity.$$.bak"