Set Terminal Tab/Window Title -- Cross-Platform!
(Several) dozens of terminal windows/tabs open at the same time? Me too. Gets confusing trying to find a particular shell sometimes. Snow Leopard introduced a feature that allows you to set a specific title for each of your Terminal windows, but to do it you have to use the mouse/GUI. Ugh.
Here is a solution that not only is mouse/GUI free, it actually works across platforms. Source (or add) the following into your .bashrc:
set_terminal_title() {
if [[ -z $@ ]]
then
TERMINAL_TITLE=$PWD
else
TERMINAL_TITLE=$@
fi
}
alias stt='set_terminal_title'
STANDARD_PROMPT_COMMAND='history -a ; echo -ne "\033]0;${TERMINAL_TITLE}\007"'
PROMPT_COMMAND=$STANDARD_PROMPT_COMMAND
Now, when you open a new shell, just type 'stt <TITLE-STRING>' to give a title to that window/tab for that shell session.
Makes my day.
feed
Comments
0 comments postedPost new comment