Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.windows.x Frequently Asked Questions (FAQ) 2/7
Section - 32) How can I change the titlebar of my terminal window?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Business Photos and Profiles ]


Top Document: comp.windows.x Frequently Asked Questions (FAQ) 2/7
Previous Document: 31) Where can I get an X-based 3-D object viewer?
Next Document: 33) Where can I find the xterm control sequences?
See reader questions & answers on this topic! - Help others by sharing your knowledge

The solution involves sending an escape sequence to xterm which will cause it
to update the property which the window manager relies upon for the string
which appears in the window titlebar.

A solution is as easy as typing this in an xterm running a shell:

		echo "ESC]2;TEXT^G"

where ESC is the escape key, TEXT is the string you wish to have displayed,
and ^G is a Control-G (the BEL character). Note that the semi-colon is
demanded by more recent versions of xterm. (Some shells and editors need an
escape character, typically ^V, before accepting control characters
literally.)

Here is a more complicated csh alias which changes the titlebar to the
current working directory when you change directories:

		alias newcd 'cd \!*; echo -n ESC]2\;$cwd^G'

(for other shells e.g. ksh you will need to write a function for cd to print
this value).

The digit '2' in these strings indicates to xterm that it should change only
the title of the window; to change both the title and the name used in the
icon, use the digit '0' instead, and use '1' to change only the icon name.

Note: another way to do this, which prevents an incorrect display of the
local directory if a modified `cd` is used in a subshell, is to wrap the
escape sequences into the PS1 prompt itself.

If you are using DECterm, the sequence for window titles is
"ESC]21;TEXTESC\"; for icons, the sequence is "ESC]2L;TEXTESC\".  For an
HPterm, you need "ESC&f0k<length>DTEXT". Here <length> is the number of
characters in TEXT, as a decimal number in ASCII. To change the icon name,
use "ESC&f-1k<length>DTEXT".  [thanks to Karsten Spang (krs@kampsax.dk);
12/94]

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: comp.windows.x Frequently Asked Questions (FAQ) 2/7
Previous Document: 31) Where can I get an X-based 3-D object viewer?
Next Document: 33) Where can I find the xterm control sequences?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)





Last Update March 27 2014 @ 02:12 PM