[Techtalk] Changing the titlebar on an xterm

Carol Williams carolswilliams at gmail.com
Thu May 1 23:53:47 UTC 2014

I've always done something like this:

for the .kshrc
PS1='^[]0;${USER}{@${HOST}: ${PWD}^Gksh$ '

for the .bashrc
PS1="\[\033]0;\u@\h:  \w\007\]bash\\$  "

Carol Williams

On Thu, May 1, 2014 at 3:43 PM, Akkana Peck <akkana at shallowsky.com> wrote:

> 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.
>         ...Akkana
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/techtalk

If you can spend a perfectly useless afternoon in a perfectly useless
manner, you have learned how to live.  -- Lin Yutang

More information about the Techtalk mailing list