tmux: tmux 2.7 does not change window name by default


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 “33k%s:%s33\” “${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.

0001_tmux-window-name-is-not-renamed.png

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.

0002_tmux-window-name-is-renamed.png

Android | Linux | SDL - Narrow Escape