From f6fdfeb9fdf3793132cd7147517c563293886290 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 8 May 2024 15:32:38 -0700 Subject: [PATCH] mux: ssh: add override_proxy_command to SshDomain This enables users to override the normal invocation completely, which is helpful for example when connecting into a gui from a remote host. I was wondering why prefer-mux was in here, and my commit message from 7afc9e4d56f13ed71c68148a6e9cd1a0dd05105f suggests that I hit an issue where the gui wasn't running and where I didn't care because I wanted to hit the mux. I think that makes it a little awkward to blanket remove the --prefer-mux flag, but for those that don't want it, they should now be able to configure to allow connected to the gui ``` ssh_domains = { { name = "shortname", remote_address = "hostname", override_proxy_command = "wezterm cli proxy", }, }, ``` --- config/src/ssh.rs | 3 +++ wezterm-client/src/client.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/src/ssh.rs b/config/src/ssh.rs index 1680eab46..e725800fd 100644 --- a/config/src/ssh.rs +++ b/config/src/ssh.rs @@ -83,6 +83,9 @@ pub struct SshDomain { /// The path to the wezterm binary on the remote host pub remote_wezterm_path: Option, + /// Override the entire `wezterm cli proxy` invocation that would otherwise + /// be computed from remote_wezterm_path and other information. + pub override_proxy_command: Option, pub ssh_backend: Option, diff --git a/wezterm-client/src/client.rs b/wezterm-client/src/client.rs index 8e0a4816d..eddbabb81 100644 --- a/wezterm-client/src/client.rs +++ b/wezterm-client/src/client.rs @@ -664,7 +664,9 @@ impl Reconnectable { let sess = ssh_connect_with_ui(ssh_config, ui)?; let proxy_bin = Self::wezterm_bin_path(&ssh_dom.remote_wezterm_path); - let cmd = if initial { + let cmd = if let Some(cmd) = ssh_dom.override_proxy_command.clone() { + cmd + } else if initial { format!("{} cli --prefer-mux proxy", proxy_bin) } else { format!("{} cli --prefer-mux --no-auto-start proxy", proxy_bin)