Categories
Unix Notes

Terminal Window Titles

for bash with GLTerm and/or Apple Terminal

Please note – this doesn’t work on windows that are connected via SSH, but the prompt seems to work properly.

I just use the alias term_banner to get the window name changed.

alias term_banner='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'

case "$TERM_PROGRAM" in
    Apple_Terminal)
    PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'
    export PS1='! $ '
    ;;
    GLterm)
    PROMPT_COMMAND='echo -ne "33]0;${USER}@${HOSTNAME}: ${PWD}07"'
    export PS1='! $ '
    ;;
    *)
    export PS1='u@h:W:! $ '
    ;;
esac

That’s in .bash_profile for any that care.