home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Unix Power ToolsUnix Power ToolsSearch this book

5.15. Setting the Titlebar and Icon Text

Under most modern window managers, most windows (including xterm) are displayed with a titlebar. You can change the text in the titlebar using the following xterm escape sequence:

^[ ]2;string^G

Note that this sequence has a close bracket (]) following the ESC (Escape, ^[) -- not an open bracket. It ends with a CTRL-g character -- not a caret followed by a "g".

I use this sequence to display my current working directory and directory stack in the titlebar, where they are visible but unobtrusive. I do this by adding a few lines to my shell setup file (Section 3.3). Section 4.8 explains.

If you change the number "2" in the escape sequence to "1," it will set the text that appears in the xterm's icon instead of its titlebar. If you change it to "0," it will set the text for both the icon and the titlebar. If you use and iconify a number of xterms, you may find these sequences useful.

You may also wish simply to specify an icon name and/or title text for a given window, statically, for those situations where the window is only used to display output from some program, and not for interactive use. Both xterm and rxvt allow this, using the -n option to specify the icon name and the -T option to specify the title. You may also use X resources to specify icon name or title.

The Mac OS X Terminal application lets you set the title from the Set Title command on the Shell menu as well.

--DJF and SJC



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.