1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

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
This commit is contained in:
Wez Furlong 2021-03-27 18:35:28 -07:00
parent 26923eefd6
commit 53a13e60f5

View File

@ -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<dyn Domain> = 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();