Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use Terminal with X11, revisited' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Terminal with X11, revisited
Authored by: speir on Sep 14, '05 04:40:10PM

Our lab uses a method similar to Bill's (wgscott) and we have borrowed from his script. Here is what we use in our individual tcsh environment setup files (i.e. place in your local .cshrc or .tcshrc file, NOT the system files). This has also been extensively tested. Takes care of essential X11 related startup and DISPLAY settings. Sorry for the extra bits, but wanted the snipet to have all the correct features (i.e. check for interactive session, check for remote login, etc.).

I agree with the others on getting rid of the xterm popup - just make your own xinitrc file. Should avoid modifying system files whenever possible.

--------------------------------

if ($?prompt) then

set CHECK_INTERACTIVE = "true"

### Report Unix and shell versions
set PLATFORM_UNIX_REPORT = `uname -a | awk '{print $17, $1, $3, $9"-"$10}'`
set SHELL_REPORT = `echo $version | awk '{ print $1, $2, $4}'`
set DARWIN_VERSION = `uname -a | awk '{print substr($3, 1, 1)}'`
set DARWIN_YEAR = `uname -a | awk '{print substr($13, 1, 4)}'`

### Check if Apple X11 open, launch if not
### For console login only, must skip remote sessions
### Have to check Darwin version for default location of X11.app
### sleep 0.25 = need to give system a little time to execute open command

if ( $?REMOTEHOST || $?SSH_TTY) then
goto x11_bypass
else
set X11DISP = `/bin/ps -xw -o command | grep Xauthority | grep $USER | awk '{print substr($5, 2, 1)}'`
if ( $X11DISP == "" ) then
if ( $DARWIN_VERSION >= 7 && -e /Applications/Utilities/X11.app ) then
set X11APP = "/Applications/Utilities/X11.app"
else if ( $DARWIN_VERSION < 7 && -e /Applications/X11.app ) then
set X11APP = "/Applications/X11.app"
else
echo "|== ***ERROR*** == Apple X11 not found in its default Darwin $DARWIN_VERSION location"
unset X11APP
endif
else
setenv DISPLAY :$X11DISP.0
endif
endif

if ( $?X11APP ) then
open $X11APP
sleep 0.25
set X11DISP = `/bin/ps -xw -o command | grep Xauthority | grep $USER | awk '{print substr($5, 2, 1)}'`
setenv DISPLAY :$X11DISP.0
unset X11APP
osascript -e 'tell application "Terminal"' -e 'activate' -e 'end tell'
endif

x11_bypass:

else
set CHECK_INTERACTIVE = "false"
endif



[ Reply to This | # ]