为什么我的 tmux 活动窗格标题在 ssh 到远程主机后没有变回来?

为什么我的 tmux 活动窗格标题在 ssh 到远程主机后没有变回来?

我浏览了参考资料部分中的 tmux 手册页STATUS LINE

STATUS LINE
     tmux includes an optional status line which is displayed in the bottom line of each terminal.  By default, the status line is enabled (it may be disabled with the status session
     option) and contains, from left-to-right: the name of the current session in square brackets; the window list; the title of the active pane in double quotes; and the time and
     date.

双引号中的"localhost"是状态窗格标题。

活动窗格的标题用双引号引起来;

从我的本地主机开始,我们可以看到双引号中的值是"localhost"

在此输入图像描述

然后我通过 ssh 进入构建主机,值更改为"max@build".除非我退出会话时,引号中的值仍然是"max@build"

在此输入图像描述

  • 为什么标题没有改回 localhost?
  • 另外,为什么不refresh-client将标题改回 localhost?
  • 如何让窗格标题返回到本地主机?

答案1

状态行中的标题被主机“build”的转义序列更改。仅终止 ssh 连接不会将标题更改回来。

发送"\ekTEST\e\\"到终端会将标题更改为“TEST”。即 ESC k TEST ESC 反斜杠。

echo -en "\ekTEST\e\\"

实际上,这也行得通

echo -e "\ekTEST"

相关内容