# Found at https://www.reddit.com/r/tmux/comments/nyjjwy/add_hostname_of_remote_server_in_status_bar/ # and modified to set also "ssh" prefix. ssh() { if [ -n "$TMUX" ]; then tmux -2u rename-window "ssh $(echo $* | rev | cut -d '@' -f1 | rev)"; command ssh "$@"; tmux -2u set-window-option automatic-rename "on" > /dev/null; else command ssh "$@"; fi }