【问题标题】:Why Tmux will not stop altering terminal title while the prompt is waiting a command?为什么提示符等待命令时 Tmux 不会停止更改终端标题?
【发布时间】:2023-03-25 11:27:02
【问题描述】:

我在 Fedora 中通过 GNOME 终端使用 Fish 和 byobu。我没有要求 Fish 更改终端标题。

猫 ~/.config/byobu/profile.tmux 来源 $BYOBU_PREFIX/share/byobu/profiles/tmux set -g status-right '#(gitmux -cfg ~/.config/byobu/gitmux.conf) #{pane_current_path}' 设置选项 -g 状态间隔 1 设置选项 -g 设置标题 set-option -g set-titles-string '#{?#{==:#{host},localhost},#{host_short} -:,}#{pane_current_path}#{pane_current_path}' 设置允许重命名关闭 设置选项 -g 允许重命名关闭

当我cd某个目录时,它会按预期短暂更改终端标题,然后将其更改为/home/psychoslave,无论实际路径是什么。但是,只要我运行一个程序,比如yes,标题就会回到正确的当前路径。

我可以调整什么以始终在终端标题中显示当前 Tmux 窗格的目录?

【问题讨论】:

    标签: tmux gnome-terminal byobu


    【解决方案1】:

    更多信息请参见https://github.com/fish-shell/fish-shell/issues/5699

    #!/bin/sh
    :<<:about:
      Fix initial shell set up when opening a new a Tmux
    
      This is intended to be used in combination with a Tmux configuration such as:
      set-environment -g ENV $HOME/.config/byobu/enforce_user_shell.sh
      set -g default-shell /bin/sh
      set -g default-command $SHELL
    
      NOTE: Fit ENV set up above to match the current script.
    :about:
    
    # If Tmux did `set -g default-shell /bin/sh`
    [[ $SHELL = '/bin/sh' ]] || exit
    
    # POSIX test for “$TERM starts with 'screen'”, matching "screen-256color" too
    case "$TERM" in screen*) true ;; *) false ;;  esac || exit
    
    # Open a new tmux window, not impacted by the bug, at position 0 and exit
    tmux move-window -s0 -t2 && tmux new-window -t0 && exit
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-03
      • 2014-12-26
      • 1970-01-01
      • 2015-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多