wezterm icon indicating copy to clipboard operation
wezterm copied to clipboard

`wezterm ssh` doesn't support OSC 7 shell cwd integration

Open 9999years opened this issue 2 months ago • 0 comments

When using wezterm ssh, spawning a new pane will not use the current pane's working directory as the initial working directory.

When using wezterm ssh, the SshDomain is constructed manually, rather than using an entry in the user's config.ssh_domains.

https://github.com/wezterm/wezterm/blob/118802c24420f3f4c206333cc7885cd922142e8e/wezterm-gui/src/main.rs#L145-L152

This means that when the remote ssh command is constructed, the current directory is always ignored:

https://github.com/wezterm/wezterm/blob/118802c24420f3f4c206333cc7885cd922142e8e/mux/src/ssh.rs#L318-L322

As a result, although (e.g., in fish), cding does send OSC 7 commands through to the host WezTerm correctly, WezTerm is unable to use that information to spawn new panes and tabs in the current directory.

I can tell that WezTerm is parsing the remote session's OSC 7 commands correctly because the window title updates to match the current directory, and because I can see it mentioned when running WEZTERM_LOG="info,wezterm_term=debug" wezterm ssh ...:

wezterm_term::terminalstate::performer > perform OperatingSystemCommand(CurrentWorkingDirectory("file://HOST/PATH"))

9999years avatar Nov 14 '25 21:11 9999years