Browse Source

add xterm title to shell

Cullum Smith 2 years ago
parent
commit
ad2cb12510
3 changed files with 9 additions and 1 deletions
  1. 3
    0
      bash/.bashrc
  2. 3
    1
      tmux/.tmux.conf
  3. 3
    0
      zsh/.zshrc

+ 3
- 0
bash/.bashrc View File

@@ -21,6 +21,9 @@ case "$(id -u)" in
21 21
 esac
22 22
 PS1='\A \[${_PS1_COLOR}\]\u@\h\[$_PS1_CLEAR\]:\[$_PS1_BLUE\]\w\[$_PS1_COLOR\]\$\[$_PS1_CLEAR\] '
23 23
 
24
+# change xterm title
25
+PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD/#$HOME/~}\007"'
26
+
24 27
 # bash-completion
25 28
 if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
26 29
     . /opt/local/etc/profile.d/bash_completion.sh

+ 3
- 1
tmux/.tmux.conf View File

@@ -22,6 +22,8 @@ set -g message-attr bold
22 22
 set -g message-fg colour117
23 23
 set -g message-bg colour235
24 24
 
25
-set-option -g status-right "#(whoami)@#(hostname -s) #[fg=colour187,bold]%a %Y-%m-%d %H:%M"
25
+set-option -g set-titles on
26
+set-option -g set-titles-string "tmux [#S:#I] #T"
27
+set-option -g status-right "#(whoami)@#h #[fg=colour187,bold]%a %Y-%m-%d %H:%M"
26 28
 set -g status-right-length 50
27 29
 set -g status-left-length 20

+ 3
- 0
zsh/.zshrc View File

@@ -34,3 +34,6 @@ case "$(id -u)" in
34 34
 esac
35 35
 RPS1='%F{blue}%~%f'
36 36
 PS1="%T %F{$_PS1_COLOR}%n@%m%#%f "
37
+
38
+# set xterm title
39
+precmd() {print -Pn "\e]0;%n@%m:%~\a"}

Loading…
Cancel
Save