tmux: xterm 헤더를 tmux에서 제공하는 헤더와 결합합니다.

tmux: xterm 헤더를 tmux에서 제공하는 헤더와 결합합니다.

Xterm의 제목을 업데이트하는 bash의 trap신호 가 있습니다.DEBUG

__title() {
    COMMAND="$BASH_COMMAND"
    case "$COMMAND" in
        history* | autojump*)
            COMMAND=""
            ;;
    esac
    if [ "$COMMAND" ]; then
        echo -ne "\e]0;${COMMAND}\007"
    else
        echo -ne "\e]0; ... \007"
}

if [ "$BASH" ]; then
    case "$TERM" in xterm* | rxvt*)
        trap '__title' DEBUG
        ;;
    esac
fi

tmux에서 이 제목을 캡처하여 창 및 창 제목에 사용할 수 있는 방법이 있습니까?

답변1

bash제목과 제목을 성공적으로 tmux결합 했습니다.

tmux.conf:

          set-option        -g default-terminal "xterm-256color"
          set-option        -g set-titles on
          set-option        -g set-titles-string "#T / #S / #I #F #W"
          set-window-option -g pane-border-status top
          set-window-option -g pane-border-format '#T'
          set -as terminal-overrides ',tmux*:Ms=\\E]52;%p1%s;%p2%s\\007'
          set -as terminal-overrides ',screen*:Ms=\\E]52;%p1%s;%p2%s\\007'

.bashrc

if [ "$BASH" ]; then
    case "$TERM" in
        xterm* | rxvt* | tmux* | screen*)
            trap '__title' DEBUG
            ;;
    esac
fi

관련 정보