comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » DISPLAY environment on Mac OS-X
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
DISPLAY environment on Mac OS-X [message #41432] Thu, 21 October 2004 01:41
Dietrich Onnasch is currently offline  Dietrich Onnasch
Messages: 1
Registered: October 2004
Junior Member
We are using IDL 6.1 on an Apple Dual G5 under Mac OS 10.3.5.
I am reporting on a problem we had, and a solution. May be someone else
has similar problems or a better solution.

The Mac OS X system allows several Users to be logged in at the same
time. To facilitate the use of IDL, the X11 application is started
already during startup for each user (System Preferences -> Accounts ->
Startup Items).
We like to launch IDL from the normal terminal window, not from the
X11/xterm window. The Terminal application is better integrated and
paste & copy and drag & drop works better. During program development it
it easy to drag a file(name) from the finder into the terminal or to
paste some code form the editor window to the terminal window and vice versa.
As long as X11 is running in the background, the only prerequisite is
that the environment variable DISPLAY is set correctly, before IDL is
started from the terminal, e.g. by the commands
setenv DISPLAY ":0.0" # tcsh shell
or
export DISPLAY=":0.0" # bash

However, DISPLAY can be different from ":0.0" ( e.g. = ":1.0") when
another user has been logged in earlier.
The problem is to set DISPLAY to the correct value automatically.

Our solution is to look for the files in the folder /tmp/.X11-unix.
You may find
ls -l /tmp/.X11-unix
total 0
srwxrwxrwx 1 UserA wheel 0 19 Oct 12:55 X0
srwxrwxrwx 1 UserB wheel 0 21 Oct 09:34 X1
For each user who is running X11 there is one line.
The owner of X0 is UserA and he has to set DISPLAY=":0.0".
UserB must set DISPLAY=":1.0".

We wrote a small shell script that looks for the current user name and
greps the corresponding line.
Here are the essential lines from the bash script:
#!/bin/bash
X11_FOLDER=/tmp/.X11-unix
currentUser=`(set \`whoami\`; echo $1)`
bb=`ls -l $X11_FOLDER | grep $currentUser`
bbb=${bb/*X/:}
usedDISPLAY=$bbb.0
export DISPLAY=$usedDISPLAY
exit 0

Thanks for comments,
Dietrich
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: ANNOUNCE: icg_lib_v410_20041018
Next Topic: Re: DISPLAY environment on Mac OS-X

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:17:02 PDT 2025

Total time taken to generate the page: 0.00583 seconds