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?

  • Can you mark some answer as accepted if there is one answering your question? (I think the one of @ecerulm from 2014-02-03 does answer your question.) – Golar Ramblar Jun 4 '18 at 16:15
  • I didn’t want to mark my own answer as accepted – RubenLaguna Jun 4 '18 at 16:18
  • That ist how stackexchange works. Also marking own answers as "correct" is wanted behaviour. – Golar Ramblar Jun 4 '18 at 16:30

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"

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.