Something similar was asked here but I wasn't able to resolve the issue for me
tmux:
# use titles
set-option -g set-titles on
set-option -g set-titles-string '#T'
# add custom term
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:XT:sitm=\E[3m'
# always reattach to user namespace
set-option -g default-shell $SHELL
set-option -g default-command "reattach-to-user-namespace -l $(echo $SHELL)"
bash
case "$TERM" in
tmux*)
printf '\033]2;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\'
PROMPT_COMMAND="printf '\033]2;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\'"
;;
xterm*)
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"; ': $PROMPT_COMMAND;
fi
;;
esac
Bash is keeping the title updated just fine, however in tmux I can't manage to get it to always keep the current title as well.
tmux (title isn't updated after changing dir)
non-tmux (title is updated after changing dir)

Is there a way to reliably keep the tmux title in sync with what the bash title is?
