bash Tmux 窗口标题不断重命名

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17289439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 05:46:31  来源:igfitidea点击:

Tmux window title keeps renaming

bashgnu-screentmux

提问by user1363214

Suddenly, both my screen/tmux started changing my windows' names after every command. They keep changing the name to the value of $PROMPT_COMMANDon every single action on the terminal, even after manually renaming them (by Ctrl+AAon screen or Ctrl+Bon tmux).

突然,我的屏幕/tmux 开始在每个命令后更改我的窗口名称。$PROMPT_COMMAND即使在手动重命名它们之后(通过Ctrl+AA在屏幕上或Ctrl+B在 tmux 上),它们也会不断将名称更改为终端上每个操作的值。

On tmux I already tried to change the tmux.confsettings to disable window auto renaming off, but seems that it was ignored.

在 tmux 上,我已经尝试更改tmux.conf设置以禁用窗口自动重命名关闭,但似乎它被忽略了。

I am using bash without the standard /etc/bashrcconfiguration file. My distro is Fedora 18.

我正在使用没有标准/etc/bashrc配置文件的bash 。我的发行版是 Fedora 18。

采纳答案by l0b0

Check whether your PS1(plus PS2, PS3or PS4if those are set) is changing the title:

检查您的PS1(加号PS2PS3或者PS4是否已设置)正在更改标题

printf %q "$PS1" | grep -F '\033'

回答by Abid H. Mujtaba

Add the following to your tmux config file:

将以下内容添加到您的 tmux 配置文件中:

set-option -g allow-rename off

回答by Evan Hu

put this in the end of the .tmux.conf file.

把它放在 .tmux.conf 文件的末尾。

set-window-option -g automatic-rename off
set-option -g allow-rename off 

then reload the tmux config file. This works for me .

然后重新加载 tmux 配置文件。这对我有用。

回答by ctrlc-root

First, if l0b0's answer fixed your problem could you please mark it as a solution? Second, for those of use who stumble upon this question and are using fedora 19 this redhat bug reportmay be of interest. It seems like the default value of $PROMPT_COMMAND set by /etc/bashrc has been changed recently. I reverted to the previous behavior like this:

首先,如果 l0b0 的回答解决了您的问题,您能否将其标记为解决方案?其次,对于那些偶然发现这个问题并正在使用 fedora 19 的用户来说,这个redhat 错误报告可能会很有趣。最近似乎更改了 /etc/bashrc 设置的 $PROMPT_COMMAND 的默认值。我恢复到以前的行为是这样的:

echo 'printf "3]0;%s@%s:%s3\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"' > /etc/sysconfig/bash-prompt-screen
chmod a+rx /etc/sysconfig/bash-prompt-screen