aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bash/bashrc.d/prompt.bash23
-rw-r--r--tmux/tmux.conf3
2 files changed, 25 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
diff --git a/tmux/tmux.conf b/tmux/tmux.conf
index ad420528..b0091fd5 100644
--- a/tmux/tmux.conf
+++ b/tmux/tmux.conf
@@ -72,6 +72,9 @@ set-option -g escape-time 0
# Don't interfere with my system clipboard
set-option -g set-clipboard off
+# Set window titles
+set-option -g set-titles on
+
# Only force individual windows to the smallest attached terminal size, not
# whole sessions
set-window-option -g aggressive-resize on