From be20f8bc9e3a193295b8aae88378ae1654c11748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan-Cristian=20T=C4=83t=C4=83roiu?= Date: Sun, 11 Feb 2024 08:47:52 +0000 Subject: [PATCH] Fix inconsistent spawn behaviour when using default_mux_server_domain. When using an exec domain as a default_mux_server_domain, you currently witness the following behavior: - Newly started mux-servers create a pane in the exec domain. - Splitting an existing pane will create the new pane in the exec domain. - Calling [wezterm cli spawn] will create a new tab or window in the exec domain. - Creating a new tab from the Gui does *not* run in the exec domain. This appears to be due to the fact that ClientDomain hardcodes an assumption that the default domain_id of the remote mux-server is 0. Instead of having ClientDomain issue a SpawnV2 RPC explicitly asking for domain_id 0, simply use DefaultDomain. --- wezterm-client/src/domain.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/wezterm-client/src/domain.rs b/wezterm-client/src/domain.rs index d9489c6e6..7efb1d231 100644 --- a/wezterm-client/src/domain.rs +++ b/wezterm-client/src/domain.rs @@ -20,7 +20,6 @@ use wezterm_term::TerminalSize; pub struct ClientInner { pub client: Client, pub local_domain_id: DomainId, - pub remote_domain_id: DomainId, pub local_echo_threshold_ms: Option, pub overlay_lag_indicator: bool, remote_to_local_window: Mutex>, @@ -238,15 +237,9 @@ impl ClientInner { local_echo_threshold_ms: Option, overlay_lag_indicator: bool, ) -> Self { - // Assumption: that the domain id on the other end is - // always the first created default domain. In the future - // we'll add a way to discover/enumerate domains to populate - // this a bit rigorously. - let remote_domain_id = 0; Self { client, local_domain_id, - remote_domain_id, local_echo_threshold_ms, overlay_lag_indicator, remote_to_local_window: Mutex::new(HashMap::new()), @@ -837,7 +830,7 @@ impl Domain for ClientDomain { let result = inner .client .spawn_v2(SpawnV2 { - domain: SpawnTabDomain::DomainId(inner.remote_domain_id), + domain: SpawnTabDomain::DefaultDomain, window_id: inner.local_to_remote_window(window), size, command,