tmux 2.7 used in Fedora 28 does not change window name by default. This article will describe a way to make tmux 2.7 to change window name.
Table of Contents
1 PROMPT_COMMAND
If you set PROMPT_COMMAND, tmux and screen will change window name dynamically.
This is useful for connecting multiple machine via SSH.
- Changing current directory with cd will change window name.
- If PROMPT_COMMAND is set on machine connected via SSH, window name will be changed to hostname of machine connected via SSH.
$ cat ~/.bashrc <snip> case ${TERM} in screen*) export PROMPT_COMMAND='printf "\033k%s:%s\033\\" \ "${HOSTNAME%%.*}" `basename "${PWD/#$HOME/~}"`' ;; *) unset PROMPT_COMMAND ;; esac
2 tmux 2.7 does not change window name by default
tmux 2.7 does not change window name by default as the following.
This is because allow-rename is changed from 1 to 0. This may be for users who want to fix window name when creating window.
3 set-option -g allow-rename on
Change allow-rename to 1 in ~/.tmux.conf.
set-option -g allow-rename on
tmux 2.7 can change window name dynamically as the following.