How to stop tmux from renaming your windows?

By Romain Dorgueil

Short answer

setw -g automatic-rename off   # ~/.tmux.conf: keep the names YOU give

By default a window is named after the program running in it, so the title keeps changing as you switch tools. Set automatic-rename off and the name you type with prefix , sticks.

Details

Out of the box tmux runs with automatic-rename on. The active pane’s current command becomes the window name, which is why a window flips from sh to vim to node as you work. The exact text comes from automatic-rename-format, but the behaviour is what matters: you do not control the name.

There are two ways to keep a fixed name. Rename one window by hand and tmux turns automatic-rename off for that window only, so the name holds:

tmux rename-window build   # this window stops auto-renaming, the others keep going

Or turn the feature off everywhere in your config, then name windows when it helps:

# ~/.tmux.conf
setw -g automatic-rename off

One more knob, separate from the above: allow-rename controls whether a program can rename the window through a terminal escape sequence. It is off by default on tmux 3.2a, which is usually what you want, since some shells and tools push titles you did not ask for.

Verified on tmux 3.2a. Defaults: automatic-rename on, allow-rename off. A fresh window shows sh; after rename-window build, its automatic-rename reads off and the name stays build.

Related