Created
August 27, 2017 14:07
-
-
Save third774/31c831d22835f21d0233e31bbd0f01dc to your computer and use it in GitHub Desktop.
Adding this to .bash_profile updates the tab title when the directory changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adding this to .bash_profile updates the tab title when the directory changes | |
# can also manually name a tab eg: title FOOBAR | |
function title { | |
export TITLE_OVERRIDDEN=1 | |
PROMPT_COMMAND='' | |
echo -ne "\033]0;"$*"\007" | |
} | |
case "$TERM" in | |
xterm*|rxvt*) | |
PROMPT_COMMAND='echo -ne "\033]0;${PWD##*/}\007"' | |
show_command_in_title_bar() | |
{ | |
if [[ "$TITLE_OVERRIDDEN" == 1 ]]; then return; fi | |
case "$BASH_COMMAND" in | |
*\033]0*) | |
;; | |
*) | |
echo -ne "\033]0;${BASH_COMMAND} - ${PWD##*/}\007" | |
;; | |
esac | |
} | |
trap show_command_in_title_bar DEBUG | |
;; | |
*) | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment