diff options
Diffstat (limited to 'bash/bashrc.d/prompt.bash')
-rw-r--r-- | bash/bashrc.d/prompt.bash | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index e0a03438..1bf3684e 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -14,8 +14,10 @@ prompt() { PROMPT_DIRTRIM=4 fi - # Prompt has hostname via SSH outside of screen/tmux + # Start building prompt PS1= + + # Prompt has hostname via SSH outside of screen/tmux if [[ -n $SSH_CLIENT && -z $STY && -z $TMUX ]] ; then PS1=$PS1'\h:' fi @@ -39,6 +41,25 @@ prompt() { # Add terminating "$" or "#" sign PS1=$PS1'\$' + # Set xterm/rxvt window title for appropriate $TERMs + case $TERM in + xterm*|rxvt*) + + # Hard-code title-set terminfo sequences, as they're + # missing from the xterm and xterm-256color definitions + local tsl fsl + tsl="\e]2;" + fsl="\a" + + # Window title string can just be user@host:~/workdir + local title + title='\u@\h:\w' + + # Put it all together + PS1="\[${tsl}${title}${fsl}\]"$PS1 + ;; + esac + # Declare variables to contain terminal control strings local format reset |