[GRASS-SVN] r30347 - in grass/trunk: lib/init macosx/app
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Feb 25 13:59:35 EST 2008
Author: kyngchaos
Date: 2008-02-25 13:59:35 -0500 (Mon, 25 Feb 2008)
New Revision: 30347
Added:
grass/trunk/lib/init/grass-xterm-mac
Modified:
grass/trunk/lib/init/variables.html
grass/trunk/macosx/app/grass.sh.in
Log:
moved Terminal.app xterm emulation to separate script, make default in app startup
Added: grass/trunk/lib/init/grass-xterm-mac
===================================================================
--- grass/trunk/lib/init/grass-xterm-mac (rev 0)
+++ grass/trunk/lib/init/grass-xterm-mac 2008-02-25 18:59:35 UTC (rev 30347)
@@ -0,0 +1,73 @@
+#!/bin/sh
+# script to emulate an xterm in OSX Terminal.app
+#
+# -William Kyngesburye
+
+# just in case accidentally called on another system
+SYSTEMOSX=`uname -s | grep "Darwin"`
+
+if [ "$SYSTEMOSX" ] ; then
+ # manually transfer the necessary env vars
+ TMPSCRIPT="/tmp/grassxterm_$$"
+ touch "$TMPSCRIPT.sh"
+ chmod +x "$TMPSCRIPT.sh"
+ echo "#!/bin/sh" > "$TMPSCRIPT.sh"
+
+ echo "DISPLAY=$DISPLAY" >> "$TMPSCRIPT.sh"
+ echo "PATH=\"$PATH\"" >> "$TMPSCRIPT.sh"
+ echo "GIS_LOCK=\"$GIS_LOCK\"" >> "$TMPSCRIPT.sh"
+ echo "GISRC=\"$GISRC\"" >> "$TMPSCRIPT.sh"
+ echo "GISBASE=\"$GISBASE\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_VERSION=\"$GRASS_VERSION\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_PAGER=$GRASS_PAGER" >> "$TMPSCRIPT.sh"
+ echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_LD_LIBRARY_PATH=\"$GRASS_LD_LIBRARY_PATH\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_WISH=\"$GRASS_WISH\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_TCLSH=\"$GRASS_TCLSH\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_HTML_BROWSER=\"$GRASS_HTML_BROWSER\"" >> "$TMPSCRIPT.sh"
+ echo "GRASS_HTML_BROWSER_MACOSX=\"$GRASS_HTML_BROWSER_MACOSX\"" >> "$TMPSCRIPT.sh"
+ echo "export DISPLAY PATH GIS_LOCK GISRC GISBASE GRASS_VERSION GRASS_PAGER DYLD_LIBRARY_PATH GRASS_LD_LIBRARY_PATH GRASS_WISH GRASS_TCLSH GRASS_HTML_BROWSER GRASS_HTML_BROWSER_MACOSX" >> "$TMPSCRIPT.sh"
+ if [ "$GRASS_ADDON_PATH" ] ; then
+ echo "GRASS_ADDON_PATH=\"$GRASS_ADDON_PATH\"" >> "$TMPSCRIPT.sh"
+ echo "export GRASS_ADDON_PATH" >> "$TMPSCRIPT.sh"
+ fi
+ if [ "$TCL_LIBRARY" ] ; then
+ echo "TCL_LIBRARY=\"$TCL_LIBRARY\"" >> "$TMPSCRIPT.sh"
+ echo "export TCL_LIBRARY" >> "$TMPSCRIPT.sh"
+ fi
+ if [ "$TK_LIBRARY" ] ; then
+ echo "TK_LIBRARY=\"$TK_LIBRARY\"" >> "$TMPSCRIPT.sh"
+ echo "export TK_LIBRARY" >> "$TMPSCRIPT.sh"
+ fi
+
+ # get command, ignore all other xterm flags
+ while true ; do
+ if [ "$1" = "-e" ] ; then break ; fi
+ shift
+ done
+ shift
+ # and add it to end of script
+ echo "$@" >> "$TMPSCRIPT.sh"
+
+ # execute
+ # save current active app/window, return to it when script finishes.
+ osascript - <<EOF
+--tell application "System Events"
+-- set save_app to item 1 of (get name of processes whose frontmost is true)
+--end tell
+tell application "Terminal"
+ activate
+ -- start new window with env/cmd script
+ do script "$TMPSCRIPT.sh; exit"
+ tell window 1
+ -- wait for it to finish
+ repeat while (processes is not equal to {})
+ delay 1
+ end repeat
+ close
+ end tell
+end tell
+--tell application save_app to activate
+EOF
+ rm -f "$TMPSCRIPT.sh"
+fi
Property changes on: grass/trunk/lib/init/grass-xterm-mac
___________________________________________________________________
Name: svn:executable
+ *
Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html 2008-02-25 17:53:26 UTC (rev 30346)
+++ grass/trunk/lib/init/variables.html 2008-02-25 18:59:35 UTC (rev 30347)
@@ -201,7 +201,8 @@
<p>GRASS_XTERM
<br>lib/init/grass-xterm-wrapper
-<br> set to any value (e.g. rxvt, aterm, gnome-terminal, konsole, Terminal.app) to substitute 'x-terminal-emulator' or 'xterm'
+<br>lib/init/grass-xterm-mac
+<br> set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app startup defaults to an internal '$GISBASE/etc/grass-xterm-mac', which emulates the necessary xterm funtionality in Terminal.app.
<p>GRASS_UI_TERM
<br> set to any value to use the terminal based parser
Modified: grass/trunk/macosx/app/grass.sh.in
===================================================================
--- grass/trunk/macosx/app/grass.sh.in 2008-02-25 17:53:26 UTC (rev 30346)
+++ grass/trunk/macosx/app/grass.sh.in 2008-02-25 18:59:35 UTC (rev 30347)
@@ -86,7 +86,7 @@
fi
fi
-# xterm - make sure X11 is in PATH
+# make sure X11 is in PATH
pathX11=`echo "$PATH" | grep '/usr/X11\(R6\)\?/bin'`
if [ ! "$pathX11" ] ; then
if [ -d "/usr/X11" ] ; then
@@ -98,6 +98,13 @@
fi
fi
+# default xterm Terminal emulator
+# note: only app startup defaults this way, CLI build still defaults to xterm
+if [ ! "$GRASS_XTERM" ] ; then
+ GRASS_XTERM="$GISBASE/etc/grass-xterm-mac"
+ export GRASS_XTERM
+fi
+
# default to internal X11 Tcl/Tk
@TCLTK_INTERNAL at if [ ! "$GRASS_TCLSH" ] ; then
GRASS_TCLSH="$GISBASE/bin/tclsh at TCLTKVER@"
More information about the grass-commit
mailing list