I'm using tmux
in OpenBSD (tmux
in the base system of OpenBSD 6.1-beta), and I do some development on Linux hosts.
Whenever I log into a Linux host, it renames the current tmux
window. This is what's displayed in the lower right-hand corner of my tmux
window:
"root@pelleplutt: /hom" 10:51 17-Mar-17
Pressing prefix–W shows the full window name as
(0) 0: ksh93* "root@pelleplutt: /home/ubuntu"
(this is after having logged into an lxc container I'm currently playing around with).
This is the name of the window even after having logged out of the Linux host, and it's a bit annoying that it sticks.
I'd like it to either (automatically) change back to whatever it was set to before logging into the Linux host, or to never change at all.
I've tried to disallow window renaming through using
set-window-option -g allow-rename off
set-window-option -g automatic-rename off
in my .tmux.conf
file, but that doesn't seem to prevent whatever it is that sets the window name from doing so.
Any ideas how I may properly disallow window renaming in tmux
?
Additional info:
The OpenBSD tmux
doesn't tell the version:
$ command -v tmux
/usr/bin/tmux
$ tmux -V
tmux: unknown option -- V
usage: tmux [-2Cluv] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
The PS1
variable on the Linux host (Ubuntu 16.04 in an lxc container) is set to
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
The allow-rename
portion of the tmux
manual:
allow-rename [on | off]
Allow programs to change the window name using a terminal
escape sequence (\ek...\e\\). The default is on.
Doing printf "\ektest\e\\"
sets the text which is displayed at the bottom left to test
if allow-rename
is on
, but not if it's set to off
.
Best Answer
From a thread in the tmux-users list asking about this:
In your output from Prefix+w:
The
"ksh93"
part is whattmux
considers the window name. It can be set by the escape sequence\033k...\033\\
, and protected by theallow-rename
option.The
"root@pelleplutt: ..."
part is the title. It's set by the escape sequence\033[2;...\033\\
, andtmux
doesn't have an option to protect that.To prevent the remote system from changing the title, you could remove that sequence from the
PS1
variable: