This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
pass OSC7 and/or OSC9;9 info as profile "commandline" variable #17980
Labels
Issue-Feature
Complex enough to require an in depth planning process and actual budgeted, scheduled work.
Needs-Tag-Fix
Doesn't match tag requirements
Needs-Triage
It's a new issue that the core contributor team needs to triage at the next triage meeting
Product-Terminal
The new Windows Terminal.
Description of the new feature/enhancement
Currently, WT supports the OSC9;9 escape sequence to set current-working-directory and uses that for local duplication of WSL, cmd, and Powershell sessions. It offers nothing for remote sessions, such as ssh.
Sidestepping the very long conversation at #12961 and elsewhere which attempts a perfect and standarized solution, it would be very helpful to propagate into an environment variable the info grabbed by WT from an OSC7 or OSC9;9 escape sequence. This ignores what WT should do internally during a "duplicate" and instead just allows for script or commandline mangling by skilled users.
A profile could then look like:
{ "commandline": "ssh.exe -t myname@myserver \" cd %WT_OSC9_9_PATH% ; bash --login \" ", ... }
See also the conversation from here:
#12961 (comment)
It's not possible today to clone remote ssh sessions and maintain the current-working-directory. Remote sessions to a single server are by far the most common case; tunneling and nested ssh sessions are relatively rare. There are edge cases pointed out exhaustively in #12961 and #3158, but this solution takes care of the common case and keeps WT from having to implement further hacks as was done for WSL.
Proposed technical implementation details (optional)
AFAICT, there is no support within WT to use environment variables or other state variables within a profilecommandline
. It may be valuable to broaden this feature to allow for other state variables to be passed intocommandline
.One possible implementation is to use
%WT_OSC7_PATH%
and%WT_OSC9_9_PATH%
Either (1) add
%WT_OSC7_PATH%
and%WT_OSC9_9_PATH%
to the environment when launching a duplicate profile or (2) make%WT_OSC7_PATH%
and%WT_OSC9_9_PATH%
and other state variables available when parsing profilecommandline
The text was updated successfully, but these errors were encountered: