Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Machine Name in The Title bar???
@ 1994-10-10 16:19 Mike Hatz
  1994-10-10 19:20 ` Ajay Shekhar
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Mike Hatz @ 1994-10-10 16:19 UTC (permalink / raw)



Is there a script someone could send along or give a hint for a hack that
displays the machine name you are logged into in the window title?

The box I am on is a DEC3000 running osf1. 

Thanks!

Mike


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-10 16:19 Machine Name in The Title bar??? Mike Hatz
@ 1994-10-10 19:20 ` Ajay Shekhar
  1994-10-11 13:50   ` FUHRMANN
  1994-10-13 14:34 ` John William Chambless
  1994-10-15 10:48 ` Christian Javet
  2 siblings, 1 reply; 10+ messages in thread
From: Ajay Shekhar @ 1994-10-10 19:20 UTC (permalink / raw)


In article <37bpie$8sd@nyx10.cs.du.edu>, mhatz@nyx10.cs.du.edu (Mike Hatz) writes:
|> 
|> Is there a script someone could send along or give a hint for a hack that
|> displays the machine name you are logged into in the window title?
|> 
|> The box I am on is a DEC3000 running osf1. 
|> 
|> Thanks!
|> 
|> Mike

Using csh the following works
setenv SHORTNAME `hostname | cut -f1 -d.`
echo -n "^[]2;$SHORTNAME

Actually, I have the working directory displayed too - simple addition
to the above
setenv SHORTNAME `hostname | cut -f1 -d.`
alias cd 'cd \!*; echo -n "^[]2;$SHORTNAME : `pwd`^G"'

Using the fancier perl script "prunepwd" you can "prune" the directory 
name too ...

-- 
Ajay Shekhar

(ashekhar@encore.com)

Disclaimer : Nothing I ever say reflects Encore's opinions ...


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-10 19:20 ` Ajay Shekhar
@ 1994-10-11 13:50   ` FUHRMANN
  1994-10-14 18:48     ` Eric Johnson
  0 siblings, 1 reply; 10+ messages in thread
From: FUHRMANN @ 1994-10-11 13:50 UTC (permalink / raw)



In article <37bpie$8sd@nyx10.cs.du.edu>, mhatz@nyx10.cs.du.edu (Mike Hatz) writes:
|> 
|> Is there a script someone could send along or give a hint for a hack that
|> displays the machine name you are logged into in the window title?
|> 
|> The box I am on is a DEC3000 running osf1. 
|> 
|> Thanks!
|> 
|> Mike

This is bash/ksh:

newcd()
{
        \cd $*
        PS1="$PWD>"
        if [ "$TERM" = "xterm" ] ; 
        then
          wintitle="`hostname`:$PWD    [`ls -ld . | awk '{print $1,$3,$4}'`]" 
          icntitle=`hostname`:...`basename $PWD`
          echo -ne "\033]2;$wintitle\007"
          echo -ne "\033]1;$icntitle\007"
         fi

}

alias cd newcd

Juergen Fuhrmann
-- 
   Juergen Fuhrmann                     fuhrmann@iaas-berlin.d400.de
   Weierstrass Institute for Applied Analysis and Stochastics (WIAS)  
   Mohrenstrasse          39                 D-10117 Berlin, Germany     
   phone: (49) 030 20377 560                 fax:   (49) 030 2004975   
                                          
                    *  Bad News is No News *
                   
                   





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-10 16:19 Machine Name in The Title bar??? Mike Hatz
  1994-10-10 19:20 ` Ajay Shekhar
@ 1994-10-13 14:34 ` John William Chambless
  1994-10-13 15:41   ` John William Chambless
  1994-10-15 10:48 ` Christian Javet
  2 siblings, 1 reply; 10+ messages in thread
From: John William Chambless @ 1994-10-13 14:34 UTC (permalink / raw)


In article <37bpie$8sd@nyx10.cs.du.edu>,
Mike Hatz <mhatz@nyx10.cs.du.edu> wrote:
>
>Is there a script someone could send along or give a hint for a hack that
>displays the machine name you are logged into in the window title?
>
Try 
	xterm -title `hostname`

This should work with most X apps, too.
Have fun!




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-13 14:34 ` John William Chambless
@ 1994-10-13 15:41   ` John William Chambless
  1994-10-13 19:27     ` oberman
  0 siblings, 1 reply; 10+ messages in thread
From: John William Chambless @ 1994-10-13 15:41 UTC (permalink / raw)


In article <37jggu$2job@whale.st.usm.edu>,
John William Chambless <chambles@whale.st.usm.edu> wrote:
>In article <37bpie$8sd@nyx10.cs.du.edu>,
>Mike Hatz <mhatz@nyx10.cs.du.edu> wrote:
>>
>>Is there a script someone could send along or give a hint for a hack that
>>displays the machine name you are logged into in the window title?
>>
>Try 
>	xterm -title `hostname`

Someone pointed out in email that  Mike probably wanted a way to
_dynamically_ change the window title, ie. have the window title
change as he logged into a different machine.

On that one, I have no clue. Anybody?

Personally, I just have a set of xterm aliases of the form:

alias xfoo 'xterm -T foo -e telnet foo.bar.baz.mil'



-- 
/* you are not expected to understand this */


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-13 15:41   ` John William Chambless
@ 1994-10-13 19:27     ` oberman
  1994-10-14  6:52       ` Arto V. Viitanen
  0 siblings, 1 reply; 10+ messages in thread
From: oberman @ 1994-10-13 19:27 UTC (permalink / raw)


In Article <37jkes$12c8@whale.st.usm.edu>
chambles@whale.st.usm.edu (John William Chambless) writes:

>Someone pointed out in email that  Mike probably wanted a way to
>_dynamically_ change the window title, ie. have the window title
>change as he logged into a different machine.
>
>On that one, I have no clue. Anybody?

It's in the documentation that comes with xterm, but is none too easy to find.
It's in a file named ctlseqs.PS located in doc/hardcopy/xterm. It's about 2600
lines of PostScript which is why I won't include it here. It covers a lot more
than just setting the title.

The strings you are interested are near the bottom of page 4.
<esc>]0;string<bel> changes both the title and the icon to "string"
<esc>]1;string<bel> changes both the icon to "string"
<esc>]2;string<bel> changes the title to "string"
<esc>]50;font<bel> changes the font to "font"

<esc> is 33(8) and <bel> is 7.

R. Kevin Oberman			
Energy Sciences Network (ESnet)
National Energy Research Supercomputer Center (NERSC)
Lawrence Livermore National Laboratory (LLNL)
Internet: koberman@llnl.gov		+1 510-422-6955


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-13 19:27     ` oberman
@ 1994-10-14  6:52       ` Arto V. Viitanen
  0 siblings, 0 replies; 10+ messages in thread
From: Arto V. Viitanen @ 1994-10-14  6:52 UTC (permalink / raw)


>>>>> "oberman" == oberman  <oberman@icaen.llnl.gov> writes:
In article <37ju4u$dmc@lll-winken.llnl.gov> oberman@icaen.llnl.gov writes:
 oberman> In Article <37jkes$12c8@whale.st.usm.edu> chambles@whale.st.usm.edu
 oberman> (John William Chambless) writes:
 >> Someone pointed out in email that Mike probably wanted a way to
 >> _dynamically_ change the window title, ie. have the window title change
 >> as he logged into a different machine.
 >> 
 oberman> The strings you are interested are near the bottom of page 4.
 oberman> <esc>]0;string<bel> changes both the title and the icon to "string"
 oberman> <esc>]1;string<bel> changes both the icon to "string"
 oberman> <esc>]2;string<bel> changes the title to "string"
 oberman> <esc>]50;font<bel> changes the font to "font"

 oberman> <esc> is 33(8) and <bel> is 7.

Yes, I use them to set my xterm title to contain current directory and
machine. Depending on the machine I am, I use either tcsh or zsh. On tcsh, I
have:

alias precmd 'echo -n "^[]2;`pwd` ($HOST)^G"'

Where ^[ is actually <esc> and ^G is actually <bel>. This is based on the
fact, that tcsh evaluates precmd alias before it prints the prompt.

On zsh, I have

function precmd() {
	echo -n "^[]2;`pwd` ($HOST)^G"
}

since zsh uses function precmd for same efect as tcsh uses the alias.

Arto V. Viitanen				         Internet: av@cs.uta.fi
University Of Tampere,		        X.400: S=av;OU=cs;O=ut;ADMD=fumail;C=fi
Finland							 http://www.uta.fi/~av/


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-11 13:50   ` FUHRMANN
@ 1994-10-14 18:48     ` Eric Johnson
  1994-10-15 17:16       ` Torbj|rn Lindgren
  0 siblings, 1 reply; 10+ messages in thread
From: Eric Johnson @ 1994-10-14 18:48 UTC (permalink / raw)


fuhrmann@weyl.iaas-berlin.de (FUHRMANN) writes:


>In article <37bpie$8sd@nyx10.cs.du.edu>, mhatz@nyx10.cs.du.edu (Mike Hatz) writes:
>|> 
>|> Is there a script someone could send along or give a hint for a hack that
>|> displays the machine name you are logged into in the window title?

(ksh method deleted...)


I, too, log in to other systems quite a lot.

I use the following C shell (csh) alias:

alias   xcd     'cd \!* ; echo -n "^[]2;`whoami` @ `hostname`    `pwd` ^G"'

^[ is ESCAPE
^G is bell (ASCII 7)

With this, I can use `xcd' in place of `cd'. It places the
current username, hostname and directory in the window title
bar (using xterm windows).

More on this can be found in Using X by Johnson (yours truly)
and Reichard, MIS: Press.

Hope this helps,
-Eric
-- 
Eric F. Johnson                   email:  johnsone@camax.com
CAMAX Manufacturing Technologies  phone:  +1 612 854 5300
7851 Metro Parkway                fax:    +1 612 854 6644
Minneapolis, MN 55425-1528 USA


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-10 16:19 Machine Name in The Title bar??? Mike Hatz
  1994-10-10 19:20 ` Ajay Shekhar
  1994-10-13 14:34 ` John William Chambless
@ 1994-10-15 10:48 ` Christian Javet
  2 siblings, 0 replies; 10+ messages in thread
From: Christian Javet @ 1994-10-15 10:48 UTC (permalink / raw)


In article <37bpie$8sd@nyx10.cs.du.edu>,
Mike Hatz <mhatz@nyx10.cs.du.edu> wrote:
%% 
%% Is there a script someone could send along or give a hint for a hack that
%% displays the machine name you are logged into in the window title?
%% 
%% The box I am on is a DEC3000 running osf1. 
%% 
%% Thanks!
%% 
%% Mike

 Hello !!

 If you are using tcsh, change the prompt of you xterm. Add the following
 lines in your .cshrc file:

   if ( $?term ) then
     if  ( "$term" == 'xterm' ) then 
        set prompt = '%{\033]0;%m - %~\007%}%B %~ >%b '  
     else
        set prompt = '%m - %~ %# '
     endif
   else
     set prompt = '%m - %~ %# '
   endif
 
 (Note: you could add a test for testing the shell (this doesn't work under
        csh!))

 If you put this on all the .cshrc you have (I mean all machines) it will be
 nice to see the hostname and path in all your xterm (even when iconified) and
 the titlebar change when you cd in another directory. 

 Try it ! 

                     Chris.
###################################################################
# Christian Javet              # (e-mail)     javet@di.epfl.ch    #
# Chemin des Vignerons 9       # -------------------------------- #
# 1807 - BLONAY                #        WWW home page:            #
# (021) 943 19 66              #   http://diwww.epfl.ch/~javet/   #
###################################################################


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Machine Name in The Title bar???
  1994-10-14 18:48     ` Eric Johnson
@ 1994-10-15 17:16       ` Torbj|rn Lindgren
  0 siblings, 0 replies; 10+ messages in thread
From: Torbj|rn Lindgren @ 1994-10-15 17:16 UTC (permalink / raw)


In article <1994Oct14.184835.9098@camax.com>,
Eric Johnson <johnsone@camax.com> wrote:
>alias   xcd     'cd \!* ; echo -n "^[]2;`whoami` @ `hostname`    `pwd` ^G"'
[...]
>With this, I can use `xcd' in place of `cd'. It places the
>current username, hostname and directory in the window title
>bar (using xterm windows).

Is anyone still using csh? I thought everone had switched to tcsh long
ago ;-) tcsh invokes the alias cwdcmd when the working directory is
changed (if that alias exists). This makes it trivial to change the
title-bar when the working directory is changed.

I uses alias cwdcmd echo -n '"^[]1;${HOST}\a^[]2;${HOST}:`dirs`\a"'
This changes both the title and the icon-name.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~1994-10-15 17:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-10 16:19 Machine Name in The Title bar??? Mike Hatz
1994-10-10 19:20 ` Ajay Shekhar
1994-10-11 13:50   ` FUHRMANN
1994-10-14 18:48     ` Eric Johnson
1994-10-15 17:16       ` Torbj|rn Lindgren
1994-10-13 14:34 ` John William Chambless
1994-10-13 15:41   ` John William Chambless
1994-10-13 19:27     ` oberman
1994-10-14  6:52       ` Arto V. Viitanen
1994-10-15 10:48 ` Christian Javet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox