← Back to team overview

ubuntu-x-swat team mailing list archive

Re: [Bug 678322] [NEW] Can't set titlebar text with ESC sequence

 

On Sun, 21 Nov 2010, Akkana Peck wrote:

> Public bug reported:
>
> Binary package hint: xterm
>
> I used to be able to change the titlebar inside an xterm window with:
> echo 'ESC]2;New titleESC' (substitute ^V and the ESC key to insert
> escape characters; I used a shell alias).

That second ESC should be a BEL (the \007 noted below).

I have 10.04, etc., in a VM.  I can set the title using vttest (verified 
with the xterm #256), but agree that at the bash prompt, that something is 
resetting the title.

"set" shows me this string, which is where my title is coming from:

PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '

Reading root's .bashrc, I see that it does compute a color prompt, but
then discards that infomation (line 59, "If this is an xterm") by 
resetting PS1:

if [ -n "$force_color_prompt" ]; then
     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
         # We have color support; assume it's compliant with Ecma-48
         # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
         # a case would tend to support setf rather than setaf.)
         color_prompt=yes
     else
         color_prompt=
     fi
fi

if [ "$color_prompt" = yes ]; then
     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\33[01;34m\]\w\[\033[00m\]\$ '
else
     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
     ;;
*)
     ;;
esac

> This no longer works, and does nothing; the title remains 'xterm'.
>
> After reading bug 408496, I've tried adding in .Xdefaults:
> XTerm*utf8Title: true
> XTerm*allowTitleOps: true
> but it doesn't help. I've also tried it with XTerm*utf8Title: false since I'm not really clear what that resource is supposed to do. (I'm sending plain ascii for the title, no extra UTF-8 characters, in any case.)
>
> The color prompt code in /root/.bashrc doesn't set the title either:
>    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'

probably PS1 is evaluated second - I'd fix it by commenting out the second
assignment to PS1 (and report a bug against bash or whatever is used to
hold these startup scripts).

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

-- 
Can't set titlebar text with ESC sequence
https://bugs.launchpad.net/bugs/678322
You received this bug notification because you are a member of Ubuntu-X,
which is subscribed to xterm in ubuntu.



References