Adicione as seqüências de escape set-title ao arquivo rc do seu shell. Para bash
v4, isso seria:
if [[ $TERM == xterm* ]]; then
# This puts "user@host workdir" into the titlebar.
# (look for section "PROMPTING" in bash's manual)
title='\u@\h \w'
PS1+="\[\e]0;$titlecase $TERM in
[xkE]term*|rxvt*|cygwin)
title_seq='\e]0;%supdate_title() {
title "$USER@$HOSTNAME ${PWD/#$HOME/~}"
}
PROMPT_COMMAND="update_title"
7';;
screen*)
# only set the "screen"window title
title_seq='\ek%s\e\';;
esac
# Very useful for: title syslog && tailf /var/log/syslog
title() { [ "$title_seq" ] && printf "$title_seq" "$*"; }
# Modify the prompt string.
if [ "$title_seq" ]; then
title='\u@\h \w'
PS1+="\[$(printf "${title_seq//\/\\}" "$title")\]"
fi
7\]"
fi
no seu ~/.bashrc
.
Pare de ler aqui, a menos que goste de brincar com bash
scripts.
O código acima é, na verdade, uma versão muito simplificada do meu ~/.bashrc
snippet:
if [[ $TERM == xterm* ]]; then
# This puts "user@host workdir" into the titlebar.
# (look for section "PROMPTING" in bash's manual)
title='\u@\h \w'
PS1+="\[\e]0;$titlecase $TERM in
[xkE]term*|rxvt*|cygwin)
title_seq='\e]0;%supdate_title() {
title "$USER@$HOSTNAME ${PWD/#$HOME/~}"
}
PROMPT_COMMAND="update_title"
7';;
screen*)
# only set the "screen"window title
title_seq='\ek%s\e\';;
esac
# Very useful for: title syslog && tailf /var/log/syslog
title() { [ "$title_seq" ] && printf "$title_seq" "$*"; }
# Modify the prompt string.
if [ "$title_seq" ]; then
title='\u@\h \w'
PS1+="\[$(printf "${title_seq//\/\\}" "$title")\]"
fi
7\]"
fi
Na verdade, esse era meu antigo % snippet de~/.bashrc
. Ao descobrir PROMPT_DIRTRIM=1
, tive que substituir a modificação $PS1
(a última declaração if
) por: