sshbyobu

byobu renames windows in ssh session


I connect to a remote computer with ssh and start a byobu session on the remote machine. Whenever I change the directory in a byobu window, the window gets renamed to username@remote-pc:~/.../.../.... When I rename the window using F8 the name persists until the next cd.

How can I prevent this?


Solution

  • I had the same problem on Fedora.

    In each bash session, PROMPT_COMMAND is set by default in /etc/bashrc to __vte_prompt_command

    man bash says

    PROMPT_COMMAND
    If set, the value is executed as a command prior to issuing each primary prompt.
    

    __vte_prompt_command is defined in /etc/profile.d/vte.sh

    type __vte_prompt_command gives

    __vte_prompt_command is a function
    __vte_prompt_command () 
    { 
        local pwd='~';
        [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/};
        printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)"
    }
    

    to prevent this, you could add unset PROMPT_COMMAND after sourcing /etc/bashrc in your ~/.bashrc

    You may also want to do this only inside a byobu session, you could test byobu environment variable for that (BYOBU_RUN_DIR?)