titlebar and titletip shows "None" on local shells.

Asked by Jason Liquorish

I have titlebars and titletips on and my local shells have the title "None", shells running ssh sessions have the correct title "user@hostname: ~".

I have attached a screenshot of this problem.

Question information

Language:
English Edit question
Status:
Answered
For:
Terminator Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jason Liquorish (jason-liquorish) said :
#1
Revision history for this message
Chris Jones (cmsj) said :
#2

Normally the title would be emitted by your shell. Could you let me know what the output of the following commands is please?

echo $TERM
echo $PROMPT_COMMAND

Revision history for this message
Jason Liquorish (jason-liquorish) said :
#3

The output from each command is:

jason@Kryten:~$ echo $TERM
xterm
jason@Kryten:~$ echo $PROMPT_COMMAND

jason@Kryten:~$

Revision history for this message
Chris Jones (cmsj) said :
#4

> jason@Kryten:~$ echo $PROMPT_COMMAND
>

Assuming you are running bash, then this is the issue. The title is set by the shell via an escape sequence, which is usually part of $PROMPT_COMMAND. For example:

cmsj@kodachi:~$ grep PROMPT_COMMAND .bashrc
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'

Revision history for this message
Jason Liquorish (jason-liquorish) said :
#5

I have a pretty standard Ubuntu install and I have just added the terminator PPA and installed Terminator. I have added PROMPT_COMMAND to my .bashrc and it is now working as expected. Thank you.

Revision history for this message
chantra (chantra) said :
#6

converting to a question as this might affect other users that do not have a PROMPT_COMMAND set in the environment (fresh install of archlinux....)

Revision history for this message
chantra (chantra) said :
#7

The titlebar is dependant on the environment variable PROMPT_COMMAND.
If this variable is not set, The titlebar will display "None".
To fix this, one must add the following to ~/.bashrc

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac

Revision history for this message
chantra (chantra) said :
#8

The titlebar is dependant on the environment variable PROMPT_COMMAND.
If this variable is not set, The titlebar will display "None".
This issue might happen on freshly installed distro that comes with an almost empty ~/.bashrc

To fix this, one must add the following to ~/.bashrc

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
    ;;
*)
    ;;
esac

FAQ #494: “titlebar and titletip shows “None"".

Revision history for this message
Muhammad Shoaib (error404notfound) said :
#9

and what if i wanna do it in zsh?

Revision history for this message
Chris Jones (cmsj) said :
#10

Muhammad: I'm not familiar with zsh, but I'm sure googling for how to set the terminal title with zsh will yield some enlightenment :)

Revision history for this message
Muhammad Shoaib (error404notfound) said :
#11

for zsh:

case $TERM in
    xterm*)
        precmd () {print -Pn "\e]0;%n@%m: %~\a"}
        ;;
esac

Can you help with this problem?

Provide an answer of your own, or ask Jason Liquorish for more information if necessary.

To post a message you must log in.