Restore automatic window title after rename-window in tmux

18

6

By default, tmux will show the title of the focused pane in the status bar. After using rename-window to set a title manually, how do you restore the default behavior?

First idea was to set a blank title, which didn't work. According to the soruce code, it sets the window option "automatic-rename" to 0, but doing things like setw -g automatic-rename on doesn't seem to have any effect (aside from confirming that the option was set).

tripflag

Posted 2014-08-02T20:01:10.517

Reputation: 401

Answers

23

setw automatic-rename

This will work on Current window

setw -g automatic-rename

This will affect global session so all new window will be affected

Ahed Eid

Posted 2014-08-02T20:01:10.517

Reputation: 792

This still does not restore any dynamically set window names while you had another name set, which is what I wanted (either restore old title, or revert to whatever was set last). But it doesn't look like this is possible without a patch so thanks anyways. – tripflag – 2015-09-19T19:04:00.620

2@tripflag, yes, it does. I've just tried it. – Atcold – 2015-10-30T15:30:19.840

3Just to make it clearer to everybody, you have to type your tmux prefix (commonly Ctrl-B) then colon : then your setw stuff – Davide – 2016-09-27T21:43:11.323

0

@Ahed-eid's answer works only when you use automatic-rename which, as I think, isn't OC's case.

The correct answer is to:

  • set allow-rename on - so your manual setting of window title can be overridden,
  • set automatic-rename on - when you want tmux itself to set window name and title through its mechanism of terminal inspection
  • set automatic-rename off - when you want to control window name and title from terminal (for example from a shell prompt)

Seweryn Niemiec

Posted 2014-08-02T20:01:10.517

Reputation: 1