From 53a13e60f52930e07dc837673c920de964ddae30 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 27 Mar 2021 18:35:28 -0700 Subject: [PATCH] start up "local" domain when spawning ssh allows defining launch_menu items to spawn explicitly locally: ```lua return { launch_menu = { { label = "Local zsh", args = {"zsh", "-l"}, domain = {DomainName="local"}, }, } } ``` refs: https://github.com/wez/wezterm/issues/468 --- wezterm-gui/src/main.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 067b9ccfb..322cdc917 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -115,6 +115,10 @@ async fn async_run_ssh(opts: SshCommand) -> anyhow::Result<()> { mux.set_default_domain(&domain); domain.attach().await?; + // Allow spawning local commands into new tabs/panes + let local_domain: Arc = Arc::new(LocalDomain::new("local")?); + mux.add_domain(&local_domain); + let window_id = mux.new_empty_window(); let _tab = domain .spawn(config.initial_size(), cmd, None, *window_id) @@ -133,20 +137,12 @@ fn run_ssh(opts: SshCommand) -> anyhow::Result<()> { let gui = crate::frontend::try_new()?; - // Keep the frontend alive until we've run through the ssh authentication - // phase. This is passed into the thread and dropped when it is done. - let activity = Activity::new(); - // Initiate an ssh connection; since that is a blocking process with // callbacks, we have to run it in another thread promise::spawn::spawn(async { if let Err(err) = async_run_ssh(opts).await { terminate_with_error(err); } - // This captures the activity ownership into this future, but also - // ensures that we drop it either when we error out, or if not, - // only once we reach this point in the processing flow. - drop(activity); }) .detach();