image
image

|


Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old September 5th, 2006, 01:49 AM
Registered User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sagansstash is on a distinguished road
Using X11 within Term.app?

Hey All,

Im fairly new to all this, so please forgive any ignorance on my part.

Recently, I found a piece of code to put into my .cshrc file that supposedly allows me to run X11 from inside apple's Term.app, the purpose being to get a shiny clean menu bar, and automatic text wrapping when you resize a window (something Ive found xgterm in X11 to be lacking)

I would just like to know what the code actually does, how its working, and why it works. It consists of the following:

if ($OSTYPE == "darwin" && !($?DISPLAY) && -e /tmp/.X11-unix/* ) then
set X11_FOLDER = /tmp/.X11-unix
set currentUser = `whoami`
set bb = `/bin/ls -l $X11_FOLDER | grep $currentUser`
set bbb = `echo $bb | awk '{printf(":%d.0", $9);}'`
setenv DISPLAY $bbb
echo "Setting DISPLAY = $bbb"
endif

From my (very) linited understanding, I cant see how this works, but it does seem to.

Thanks very much.
Reply With Quote
  #2  
Old September 5th, 2006, 09:51 AM
lurk's Avatar
Mitä?
 
Join Date: Mar 2002
Location: Land o' skeeterz
Posts: 2,076
Thanks: 0
Thanked 0 Times in 0 Posts
lurk is on a distinguished road
All that it takes to make X11 work from terminal.app is to get the DISPLAY environment variable set to the correct value. Often this is just DISPLAY=myhost:0 but not always, when you are using fast user switching for instance you might have more than one user running X11 and that would create different numbers.

Roughly the code you pasted checks to see if it is running on OSX and X11 is running. It then looks for what is basically a PID file associated with the current user and then pulls out the display number from the name of that file. Finally it constructs the display string using the hostname and the display number.

On thing is that this script will fail in cases where you have more than one server running as the same user. This is useful in cases where you need to have two X11 servers running with different color depths. And nothing to worry about since if you need to do that you will have many more pressing problems to address
__________________
Wenn ist das Nunstruck git und Slotermeyer? Ja!...
Beiherhund das Oder die Flipperwaldt gersput!
Reply With Quote
  #3  
Old September 5th, 2006, 10:55 AM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,482
Thanks: 0
Thanked 0 Times in 0 Posts
Viro will become famous soon enoughViro will become famous soon enough
Code:
DISPLAY=:0.0
setenv DISPLAY
That should be all the code you need to get X11 working from Apple's terminal. What that does is specify the address of the display, which in this case is the local machine, at port (??) 0.0
Reply With Quote
  #4  
Old September 6th, 2006, 09:24 AM
lurk's Avatar
Mitä?
 
Join Date: Mar 2002
Location: Land o' skeeterz
Posts: 2,076
Thanks: 0
Thanked 0 Times in 0 Posts
lurk is on a distinguished road
Viro, that is the simple answer that works 97.3% of the time. Now, start X11 for a user and then use fast user switching to become a different user. At that point start X11 and try to set the display that way. You will find that the second user's display is :1.0 oops.

The complex code above deals with that case and correctly set the second user's display to :1.0
__________________
Wenn ist das Nunstruck git und Slotermeyer? Ja!...
Beiherhund das Oder die Flipperwaldt gersput!
Reply With Quote
  #5  
Old September 7th, 2006, 01:44 AM
Viro's Avatar
Registered User
 
Join Date: Nov 2003
Location: Oxford, UK
Posts: 2,482
Thanks: 0
Thanked 0 Times in 0 Posts
Viro will become famous soon enoughViro will become famous soon enough
Oooh, didn't know that. Guess I learn something new every day . Thanks lurk.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Long term storage of video - real long term! karavite Design & Media 11 March 22nd, 2006 05:38 PM
Second Term - JibJab andychrist Bob's Place 4 January 21st, 2005 04:32 AM
problem starting several term in X11 chevy Unix & X11 3 May 1st, 2003 05:32 AM
coin a new Apple term waiting_for_OSX Apple News, Rumors & Discussion 8 April 17th, 2002 07:53 AM
SU term prob AdmiralAK Mac OS X System & Mac Software 3 February 11th, 2002 07:52 AM


All times are GMT -5. The time now is 02:12 PM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.