It is currently Thu, 20 Jan 2022 04:29:22 GMT



 
Author Message
 Prompt string to change xterm title?
I once saw posted somewhere a prompt string that would update an xterm's
title.  Does anyone have/remember such a prompt string?  

--
j...@arizona.edu    - James E. Ward



 Sat, 11 Jan 1997 00:07:12 GMT   
 Prompt string to change xterm title?

To change your xterm title, you simply echo the following escape
sequence to stdout (from an xterm!!):

<ESC>]2;<Text to put on your title><CTRL-G>

This can be done easily using  echo -n "<string to echo>". The -n stops
an annoying newline getting printed afterwards...

There is a little problem with getting the control characters into the
file. It is best done by using vi's control-v feature: For example, to
put "Hello world" on your title, you would write a mini shell script in
vi, entering this key sequence:

echo -n "<CTRL-v><ESC>]2;Hello World<CRTL-v><CTRL-G>"

where <CTRL-v> means press the control and v keys simultaneously. What
should appear is:

echo -n "^[]2;Hello World^G"

Then, when you run the script, the xterm title will change. You can have
the xterm title continually display your current directory in the csh
by using this alias for cd.

alias cd 'cd \!* && echo -n "^[]2;Current Dir: $cwd^G"'

If you change the value after the escape it writes to different parts of the
xterm according to the following:

0 Icon name and window title
1 Icon name only
2 window title only
50 change font to what the text says.

Regards,

        Huw Coxon
-o- The above represents my opinion only, and not (necessarily) that of BNR -o-
Huw Coxon (N.H.Co...@bnr.co.uk)                          Tel: +44 (0279) 402547
BNR Europe Ltd., London Rd., Harlow, Essex CM17 9NA      Fax: +44 (0279) 441589
-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-

---
-o- The above represents my opinion only, and not (necessarily) that of BNR -o-
Huw Coxon (N.H.Co...@bnr.co.uk)                          Tel: +44 (0279) 402547
BNR Europe Ltd., London Rd., Harlow, Essex CM17 9NA      Fax: +44 (0279) 441589
-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-



 Sat, 11 Jan 1997 18:47:56 GMT   
 Prompt string to change xterm title?
In article <310nvg$...@news.ccit.arizona.edu>,
Ward... James Ward <jew@linux> wrote:

Excerpt from the file `xterm-seqs2.txt' (should be in the xterm source code
distribution):

    ESC ] Ps ND string NP           OSC Mode
                    ND can be any non-digit Character (it's discarded)
                    NP can be any non-printing Character (it's discarded)
                    string can be any ASCII printable string
                            (max 511 characters)
                    Ps = 0 -> use string as a new icon name and title
                    Ps = 1 -> use string is a new icon name only
                    Ps = 2 -> use string is a new title only
                    Ps = 46 -> use string as a new log file name

I use one of those control sequences to update the title, icon and window
list entry under zsh(1) with the host name, the current working directory
and tty line, for example:

case $TERM {
        xterm)  PROMPT='%{^[]0;%m:%~  %l^G%}%B%m:%~%b> ';;
        *)      ...

--
Thorsten Meinecke - 31 year old computer {*filter*}
Though this be madness, yet there's method in't



 Sat, 11 Jan 1997 21:29:23 GMT   
 Prompt string to change xterm title?
In article <310nvg$...@news.CCIT.Arizona.EDU> jew@linux (Ward... James Ward) writes:

Here is:

ESC]0;newtitle^G     : Change title and icon name
ESC]1;newtitle^G     : Change icon name
ESC]2;newtitle^G     : Chane title

The ESC and ^G characters can be put into the line in VI by using the ^V
sequence to insert control characters.

swa...@litc.lockheed.com - Shane Swartz



 Sat, 11 Jan 1997 23:55:21 GMT   
 Prompt string to change xterm title?
jew@linux (Ward... James Ward) writes:

echo "^[]2;$PWD^G"

Replace $PWD with whatever you want.
For those new to UNIX, ^[ is the escape character and ^G is control-G.
--
Bruce Wachlin                             email:  wach...@cig.mot.com
Motorola                                  phone: (708) 632-4781
----------------------------------------------------------------------
 Relativists can never be absolutely sure that everything is relative.



 Sun, 12 Jan 1997 02:19:02 GMT   
 Prompt string to change xterm title?

James Ward asked:

Thorsten Meineck answered:

and Nicholas H Coxon also said:

Does anybody know any more of these nifty Ps values? Where can I readily
get access to them?

Henry
--
day  : hen...@tusc.oz.au
night: he...@qbd.com.au



 Mon, 13 Jan 1997 08:10:01 GMT   
 
   [ 6 post ] 

Similar Threads

1. Using tcsh prompt string in xterm title

2. How to change xterm title bar string?

3. change xterm title from unix prompt

4. quoting for prompt or xterm title in csh

5. Display ksh prompt in xterm title problem

6. active xterm and dtterm title string

7. Xterm's and dynamic title strings

8. Change xterm's title

9. How to change the xterm title line?

10. Change xterm title bar?


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software