8

If you start xterm from the command line giving it a title with the -T option

xterm -T "my window title" 

the window title is likely to be overwritten via escape sequences for the shell prompt, other programs' output, etc. Is there any way to prevent the initial title from being overridden?

terdon
  • 242,166
RubenLaguna
  • 485
  • 1
  • 4
  • 12

2 Answers2

9

You can control whether xterm allows title changes with the Xresources option allowTitleOps described in man xterm. If you don't want to change the defaults for your user via the ~/.Xresources you can add Xresources options from the command line using the -xrm option:

 xterm -xrm "xterm*allowTitleOps: false" -T "my title"
RubenLaguna
  • 485
  • 1
  • 4
  • 12
4

Sometimes, it's desirable to keep the original title and allow the applications to add their own title.

That could be achieved with screen. If you add:

hardstatus string 'blah - [%h]'

to you ~/.screenrc, and start screen within that xterm, then the title will always contain blah, but the applications will be able to set the part inside [...] with the usual \e[2;...\a or \e[2;...\a escape sequences.