[Techtalk] Changing the titlebar on an xterm

Akkana Peck akkana at shallowsky.com
Thu May 1 21:43:35 UTC 2014

Does anybody (besides me) still use xterm?

Silly little question: I used to have a shell alias to change the
titlebar on the current xterm, so I could indicate which terminals
were, for instance, ssh into a different machine.

It went like this:

titlebar2() {
  echo -e "^]]2; $* ^G"

where ^] and ^G are the ESC and Ctrl-G characters, respectively.

Though probably a better way to do this is
titlebar2() {
  echo -e "\033]2; $* \007"

Doesn't matter; neither one of them work any more. Apparently
something changed in the xterm source some years back so that it no
longer supports that control sequence. Every few years I google, but
I always give up because every google search finds about a jillion
ten-year-old pages telling me the way that used to work, and nothing
about what changed or why.

Anybody know a way to change an xterm's titlebar that works now,
not ten years ago? Or the reason it stopped working?

I've tried setting
XTerm.allowTitleOps: true
in .Xdefaults, and I've tried setting XTerm.utf8Title to both
true and false, but it doesn't make any difference.

I've also tried xtermset -T hello and xtermcontrol --title=hello.
They don't work either.

If it matters, this is on Debian (or Ubuntu), and this has been true
for over five years so I doubt the xterm version is relevant, but
the one I'm using right now is apparently version 278.


More information about the Techtalk mailing list