On Wed, Mar 28, 2007 at 10:48:03AM +0000, Steve wrote:
So how is one *supposed* to make this all work? I need some way to get DISPLAY set correctly most of the time, I'd go crazy if I had to set it manually every time I rlogin to another machine here at work. I typically have five or six xterms open to Solaris boxes for example. Currently having it hardcoded in my .profile works 'most of the time' but it's then a big pain sorting out the ssh use because the special ssh value for DISPLAY is lost.
I'm sure there must be some environment variable or other that gets set if you're logging in to your machine remotely that doesn't get set if you log in directly. Set DISPLAY from .profile depending on the value of that variable?
It's not *too* difficult to detect a remote login (especially an ssh one) but how do you find what the display should be set to? I guess I can store the DISPLAY variable in a file when I start X, then at least all the local machines which have access to that can set the display correctly (assuming I'm not running more than one X server). However our test machines don't have access to my home directory so it wouldn't work for them.
I've realised (from my thoughts above) that there's an extra difficulty in some cases, I'm often logged on to other machines as a different user (e.g. rlogin -l <someone> <machine>), this adds to the difficulty.
If only rlogin (like telnet) passed the DISPLAY variable it would be easy.
Or... you could grep ps for your /(ba)?sh/ instance and see if it's running on a real vt or not... summat like that.
... but it isn't always a [ba]sh running, it's quite often a GUI application of some sort.
*clutches at straws*
:-)