|
#1
| |||
| |||
| 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. |
|
#2
| ||||
| ||||
| 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! |
|
#3
| ||||
| ||||
| Code: DISPLAY=:0.0 setenv DISPLAY |
|
#4
| ||||
| ||||
| 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! |
|
#5
| ||||
| ||||
| Oooh, didn't know that. Guess I learn something new every day . Thanks lurk. |
![]() |
| Thread Tools | |
|
|
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 |