help, setting xterm title bar text on the fly w/an escape sequence?

help, setting xterm title bar text on the fly w/an escape sequence?

Post by RHS Linux Us » Mon, 17 Mar 1997 04:00:00



Hi all..

Sorry if this is a redundant or "newbie"ish Q, but I was wondering
about being able to display the current directory in the title bar of
an xterm.. I've seen something about doing it with an escape sequence
(\033]Ps if I remember right, where P = 0 for window and icon title, 1
for icon title only and 2 for window title only ?) that instructs
xterm to stick a given string into the window title, but the details
of how to actually DO have slipped my mind and, foolishly, I neglected
to save the article..

Could anyone lend me a hand on this? Thanks in advance..

 
 
 

help, setting xterm title bar text on the fly w/an escape sequence?

Post by Mark Bakarich, regular gu » Mon, 17 Mar 1997 04:00:00



> Hi all..

> Sorry if this is a redundant or "newbie"ish Q, but I was wondering
> about being able to display the current directory in the title bar of
> an xterm.. I've seen something about doing it with an escape sequence

[snip]
Try...


(mailed & posted)
--
Regards,
--------
Mark Bakarich,  Engineer, Tucson Arizona

 
 
 

help, setting xterm title bar text on the fly w/an escape sequence?

Post by Peter Mastr » Thu, 27 Mar 1997 04:00:00




Quote:

>Hi all..

>Sorry if this is a redundant or "newbie"ish Q, but I was wondering
>about being able to display the current directory in the title bar of
>an xterm.. I've seen something about doing it with an escape sequence
>(\033]Ps if I remember right, where P = 0 for window and icon title, 1
>for icon title only and 2 for window title only ?) that instructs
>xterm to stick a given string into the window title, but the details
>of how to actually DO have slipped my mind and, foolishly, I neglected
>to save the article..

>Could anyone lend me a hand on this? Thanks in advance..

I put the following in my /etc/profile so all logins get the same
configuration.  It could just as easily go into ~/.profile to isolate
the effect to an individual user.

---
case $TERM in
  xterm)
    PS1="<ESC>]2;\$HOSTNAME:\$PWD<^G><ESC>[7m\$HOSTNAME:<ESC>[0m$ "
    export PS1
    ;;
  sun | sun-cmd)
    PS1=<ESC>]l\$HOSTNAME:\$PWD<ESC>\\\<ESC>[7m\$HOSTNAME:<ESC>[0m$ "
    export PS1
    ;;
esac
---

Note:  <ESC> is an actual escape character (033)  and <^G> is a
control-G (007).  These can be keyed in using vi by preceeding them
with a control-V.

This sequence puts hostname:/path in the window boarder and makes the
command line prompt a reversed video hostname:$.  This is helpful in
an environment where I might be on any one of a number of hosts at any
time.

Pete

--
Peter Mastren                     |

finger me for PGP public key      |    you're successful!
http://www.cerfnet.com/~pfm       |