Does anyone have any neat/elegant/clever ways of setting the DISPLAY variable when working in a situation where I may use X in different places and want to run X applications from different remote machines?
Usually I am doing the following:- Logging on to my desktop Linux box called chrisg and starting the X server there.
Running local X client applications on chrisg.
Running remote X client applications on Solaris and other boxes which I want to display on chrisg
OK, so to do the above I can simply hardcode DISPLAY=chrisg:0.0 in my .profile and all will be well.
However.... Sometimes I want to use a different desktop machine at work or I want to work from home. This results in two different requirements:-
The first case (using a different machine at work) means that my hard-coded DISPLAY=chrisg:0.0 will always be wrong.
The second case (working from home) I will be using 'ssh -X' to connect so ssh will be setting the DISPLAY variable and I don't want anything else to change it.
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.