vte.sh in my
.bashrc. One thing this does is it causes Bash to echo
"\033]7;file://$HOSTNAME$PWD\007" as part of
PROMPT_COMMAND. This uses the escape sequence "OSC 7" to send a value like
file://mylocalbox/home/kerrick to the terminal, telling it what the current hostname and directory are. When you open a new tab in GNOME Terminal, it uses the information from OSC 7 to open the terminal in the same directory as the previous tab.
I would like to configure GNOME Terminal so that if the current tab is running a SSH session, launching a new tab will SSH into the same host and change to the same directory. In other words, if the OSC 7 value is something like
file://myremotebox/foo/bar, it will run
exec ssh -t myremotebox 'cd /foo/bar && exec bash -l' instead of a default terminal session.
How can I configure GNOME Terminal to do this?