Original question:
>I'm looking for the escape sequence to set the title bar and icon
>of a DECterm. The one I use for xterms ( <esc>]0;"STRING-I_WANNA-SET<bell> )
>doesn't seem to work.
>
>BEFORE you answer, I know this can be done from the windows pull-down-menu
>but I want a script to do this and I looked in the alpha-osf-managers archive
>and pulled up:
>
><esc>[]2L STRING-I_WANNA-SET <esc>[\
>
>Which doesn't work. Worse, it hangs the window st I have to kill it and
>create another Decterm. BTW, I notice that my TERM variable is defined
>as vt300. Does that make a difference?
Thanks to the many who responded including:
Randy Rodgers <randy.rodgers_at_ci.ft-wayne.in.us>
A. Mahendra Rajah, System Manager" <A.Mahendra.Rajah_at_Meena.CC.URegina.CA>
Stephen Hagan <Stephen.Hagan_at_digital.com>
Pirie Hart <pirie_at_u.washington.edu>
Peter Stern <peter_at_wiscpa.weizmann.ac.il>
Lucio Chiappetti <lucio_at_ifctr.mi.cnr.it>
I munged what I already had with answers from the above to get the following
script.I know I'm not consistant in how I echo out the escape in each stanza
of my case statement; this just shows the many different ways of doing things
in unix. Also, this suffices for me but I only care about Irix, Xterm and
Decterms. To be complete, I included Lucio Chiappetti's script as well:
#!/bin/sh
# Xtitle.sh -- Set X Title bar
# ----------------------------------------------------------------------
if [ $# -lt 1 ]
then
echo "$0: ERROR: Usage is: $0 <TITLE>"
exit 1
fi
ESC=
BEL=
case $TERM in
vt300)
y=`printf "\235 21; %s \234" $1` # For window
echo $y
y=`printf "\235 2L; %s \234" $1` # for window icon
echo $y
exit
;;
iris-ansi)
echo "\033]2;$1\007\c"
echo "\033]1;$1\007\c"
;;
*)
echo ${ESC}"]0;"${1}${BEL} #/* ICON & WINDOW NAME */
# echo ${ESC}"]1;"${1}${BEL}; #/* ICON NAME ONLY */
# echo ${ESC}"]2;{1}${BEL}; #/* WINDOW NAME ONLY */
# echo ${ESC}${1}${ESC}"; #/* Open Windows CMD Tool */
esac
exit
-------------------------------------------------------------------------------
----------------------------------------------------------------------------
Lucio Chiappetti - IFCTR/CNR - via Bassini 15 - I-20133 Milano (Italy)
----------------------------------------------------------------------------
Fuscim donca de Miragn E tornem a sta scio' in Bregn
Che i fachign e i cortesagn Magl' insema no stagn begn
Drizza la', compa' Tapogn (Rabisch, II 41, 96-99)
----------------------------------------------------------------------------
For more info :
http://www.ifctr.mi.cnr.it/~lucio/personal.html
----------------------------------------------------------------------------
#! /bin/csh -f
#
# issue escape sequence to annotate window banner
#
# first get unqualified hostname and terminal name
#
set a = `hostname`
set b = `tty`
set aa = `echo $a | tr . '\040'`
set bb = $b:t
#
# construct escape sequences to be used
#
set escape = ^[
switch ($TERM)
#
# vt300/200/100 are for dxterm on DECs
case vt300:
set title = ( ${escape}]21\;Host $aa[1] : user $USER on terminal $bb${escape}\\ )
set icon = ( ${escape}]2L\;$bb $aa[1]${escape}\\ )
breaksw
case vt200:
set title = ( ${escape}]21\;Host $aa[1] : user $USER on terminal $bb${escape}\\ )
set icon = ( ${escape}]2L\;$bb $aa[1]${escape}\\ )
breaksw
case vt100:
if ( ! $?WINDOW_ME) then
set title = ( ${escape}]21\;Host $aa[1] : user $USER on terminal $bb${escape}\\ )
set icon = ( ${escape}]2L\;$bb $aa[1]${escape}\\ )
else
# however vt100 is also te100tool on Sunview
set title = ( ${escape}]lHost $aa[1] : user $USER on terminal $bb${escape}\\ )
endif
breaksw
# this is for Sunview and Openwindows stuff
case sun-cmd:
set title = ( ${escape}]lHost $aa[1] : user $USER on terminal $bb${escape}\\ )
breaksw
# and this is for xterm anywhere
case xterm:
set bell = ^G
set title = ( ${escape}]0\;Host $aa[1] : user $USER on terminal $bb${bell}\\ )
breaksw
# dtterm is probably
# set title = ( ${escape}]2\;Host $aa[1] : user $USER on terminal $bb${bell} )
# set icon = ( ${escape}]1\;$bb $aa[1]${bell} )
# any other terminal is not recognized
default:
exit
endsw
#
# finally issue using appropriate command for Sun or DEC
#
if ($DECSTATION) then
echo $title
if ($?icon) then
echo $icon
endif
else
/usr/5bin/echo $title
endif
=-=-=-=-=-=-=-=-=- generated by /dev/dave -=-=-=-=-=-=-=-=-=-=-=-=-=-=
David Stern Flight Dynamics
dave_at_davka.gsfc.nasa.gov Goddard Space Flight Ctr
Building 23 Room S226 301-286-9786
Received on Fri Nov 27 1998 - 14:41:00 NZDT