Operating System - HP-UX
1753278 Members
5596 Online
108792 Solutions
New Discussion юеВ

setting DISPLAY programmatically

 
Marco Mohrmann
Occasional Contributor

setting DISPLAY programmatically

Hello,

I want to set automatically the environment variable DISPLAY (Client/Server) to the correct ip address or client name of the client. This should be work, if I change the user with su or change the server with rlogin.

Thanks

Marco
5 REPLIES 5
Dan Hetzel
Honored Contributor

Re: setting DISPLAY programmatically

Hi Marco,

I'm using a few aliases based on 'xon' which open a new window with the correct DISPLAY variable, as well as the system name in the title. I use these instead of rlogin.

example:
alias newton='xon newton /usr/bin/X11/dtterm -name newton -ls'

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Thomas Kollig
Trusted Contributor

Re: setting DISPLAY programmatically

Hi!

I use ssh for remote login.
Before that I used xrsh (see attachment).

Thomas
Andreas Voss
Honored Contributor

Re: setting DISPLAY programmatically

Hi,

have a look at this thread

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x9dc579bffde7d4118fef0090279cd0f9,00.html

Bill Hassel has a great solution.

Regards
Mike Williams_3
Advisor

Re: setting DISPLAY programmatically

It's not terribly nice - but it might help:
you could put the following in your .profile:

if [ `who -a am i | grep -c dhcp` -eq '1' ]
then
export DISPLAY=`who -a am i | awk '{print $NF}'`:0.0
echo $DISPLAY >~/.homedisplay
else
export DISPLAY=`cat ~/.homedisplay`
fi

My "home display" is a PC with a dhcp-something hostname. If you have a "fixed" home machine - replace
dhcp with it's hostname.

rlogins will now have DISPLAY's pointing back to your home.
Tim Malnati
Honored Contributor

Re: setting DISPLAY programmatically

The problem is that the telnet and rlogin standards came into existance long before gui based anything. Both of these standards will pass the TERM environment variable but little else.

One way around this is to insert the DISPLAY information within the TERM variable before you pass it and then parse it back out on the other end. I've attached a file that contains the essential script elements to do this on both sides.