1 | #!/bin/sh |
---|
2 | # |
---|
3 | # Author: Aaron Voisine <aaron@voisine.org> |
---|
4 | |
---|
5 | CWD="/opt/local" |
---|
6 | |
---|
7 | # System version: 3 for Panther, 4 for Tiger, 5 for Leopard |
---|
8 | export VERSION=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 -d'.'` |
---|
9 | |
---|
10 | # On Leopard, X11.app is installed by default, and will be started |
---|
11 | # automatically via launchd. On older systems, we need to start |
---|
12 | # X11 ourself. |
---|
13 | |
---|
14 | # For Panther and Tiger, start X11 |
---|
15 | if [[ $VERSION -le 4 ]]; then |
---|
16 | |
---|
17 | ps -wx -ocommand | grep -e '[X]11' > /dev/null |
---|
18 | if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then |
---|
19 | echo "rm -f ~/.xinitrc" > ~/.xinitrc |
---|
20 | sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc |
---|
21 | fi |
---|
22 | |
---|
23 | cp -f "$CWD/bin/getdisplay.sh" /tmp/ |
---|
24 | rm -f /tmp/display.$UID |
---|
25 | open-x11 /tmp/getdisplay.sh || \ |
---|
26 | open -a XDarwin /tmp/getdisplay.sh || \ |
---|
27 | echo ":0" > /tmp/display.$UID |
---|
28 | |
---|
29 | while [ "$?" == "0" -a ! -f /tmp/display.$UID ]; do |
---|
30 | sleep 1 |
---|
31 | done |
---|
32 | export "DISPLAY=`cat /tmp/display.$UID`" |
---|
33 | |
---|
34 | ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11 |
---|
35 | |
---|
36 | fi |
---|
37 | |
---|
38 | cd ~/ |
---|
39 | exec "$CWD/bin/gimp" "$@" |
---|