titlebar and titletip shows "None" on local shells.

Asked by Jason Liquorish on 2008-09-21

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:
2008-09-21
Last reply:
2010-03-16
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

The output from each command is:

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

jason@Kryten:~$

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"'

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.

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....)

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

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"".

and what if i wanna do it in zsh?

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 :)

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.