diff --git a/config/src/ssh.rs b/config/src/ssh.rs index a42526ec3..c53c638ab 100644 --- a/config/src/ssh.rs +++ b/config/src/ssh.rs @@ -15,6 +15,20 @@ impl Default for SshBackend { } } +#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] +pub enum SshMultiplexing { + WezTerm, + None, + // TODO: Tmux-cc in the future? +} +impl_lua_conversion!(SshMultiplexing); + +impl Default for SshMultiplexing { + fn default() -> Self { + Self::WezTerm + } +} + #[derive(Default, Debug, Clone, Deserialize, Serialize)] pub struct SshDomain { /// The name of this specific domain. Must be unique amongst @@ -47,8 +61,8 @@ pub struct SshDomain { /// just connect directly using ssh. This doesn't require /// that the remote host have wezterm installed, and is equivalent /// to using `wezterm ssh` to connect. - #[serde(default = "default_true")] - pub use_multiplexer: bool, + #[serde(default)] + pub multiplexing: SshMultiplexing, /// ssh_config option values #[serde(default)] diff --git a/docs/config/lua/SshDomain.md b/docs/config/lua/SshDomain.md index 9ee092060..173bb6b05 100644 --- a/docs/config/lua/SshDomain.md +++ b/docs/config/lua/SshDomain.md @@ -54,3 +54,29 @@ return { } ``` +*Since: nightly builds only* + +You may now specify the type of `multiplexing` used by an ssh domain. +The following values are possible: + +* `"WezTerm"` - this is the default; use wezterm's multiplexing client. + Having wezterm installed on the server is required to use this mode. +* `"None"` - don't use any multiplexing. The connection is an ssh connection + using the same mechanism as is used by `wezterm ssh`; losing connectivity + will lose any panes/tabs. This mode of operation is convenient when using + SSH to connect automatically into eg: a locally hosted WSL instance, together + with the [default_domain](config/default_domain.md) option. + +```lua +return { + ssh_domains = { + { + name = "my.server", + remote_address = "192.168.1.1", + multiplexing = "None", + } + }, + + default_domain = "my.server", +} +``` diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 5ce922f8c..2d20c4cbe 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -3,7 +3,7 @@ use ::window::*; use anyhow::{anyhow, Context}; -use config::{ConfigHandle, SshBackend}; +use config::{ConfigHandle, SshBackend, SshMultiplexing}; use mux::activity::Activity; use mux::domain::{Domain, LocalDomain}; use mux::ssh::RemoteSshDomain; @@ -211,7 +211,7 @@ fn client_domains(config: &config::ConfigHandle) -> Vec { } for ssh_dom in &config.ssh_domains { - if ssh_dom.use_multiplexer { + if ssh_dom.multiplexing == SshMultiplexing::WezTerm { domains.push(ClientDomainConfig::Ssh(ssh_dom.clone())); } } @@ -334,7 +334,7 @@ fn update_mux_domains(config: &ConfigHandle) -> anyhow::Result<()> { } for ssh_dom in &config.ssh_domains { - if ssh_dom.use_multiplexer { + if ssh_dom.multiplexing != SshMultiplexing::None { continue; }