Skip to content

A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.

Space switch: attach host-store mux domains on demand; fix reconnect UI visibility

RoversX5ae9bdd8ffcf
diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs
index 3d318165..649deab2 100644
--- a/wezterm-gui/src/termwindow/mouseevent.rs
+++ b/wezterm-gui/src/termwindow/mouseevent.rs
@@ -2772,7 +2772,9 @@ impl super::TermWindow {
if space.is_default {
"house"
} else if space.is_remote {
- "server"
+ // Must be a valid SF Symbol name: macOS renders these
+ // through the native menu's imageWithSystemSymbolName.
+ "server.rack"
} else {
"square.stack"
},
@@ -3413,22 +3415,38 @@ impl super::TermWindow {
let domain_name = domain_name.to_string();
let mux_window_id = self.mux_window_id;
promise::spawn::spawn(async move {
- let mux = Mux::get();
- let domain = mux
- .get_domain_by_name(&domain_name)
- .ok_or_else(|| anyhow::anyhow!("domain {domain_name} not found"))?;
- domain.attach(Some(mux_window_id)).await?;
- window.notify(TermWindowNotif::Apply(Box::new(move |term_window| {
- if let Some(win) = term_window.window.clone() {
- term_window.activate_workspace_thread_impl(
- thread_id,
- &win,
- orphan_candidate_window_id,
- workspaces_to_kill_after_adopt,
- );
+ let result = async {
+ let mux = Mux::get();
+ // Host-store mux domains are only registered on
+ // demand (sshhost connect / CLI `connect`); build
+ // one from the SSH host store when switching into
+ // the Space cold, instead of failing the whole
+ // activation.
+ let domain = match mux.get_domain_by_name(&domain_name) {
+ Some(domain) => domain,
+ None => crate::connect_domain_from_ssh_host(&domain_name)?,
+ };
+ domain.attach(Some(mux_window_id)).await?;
+ anyhow::Ok(())
+ }
+ .await;
+ match result {
+ Ok(()) => {
+ window.notify(TermWindowNotif::Apply(Box::new(move |term_window| {
+ if let Some(win) = term_window.window.clone() {
+ term_window.activate_workspace_thread_impl(
+ thread_id,
+ &win,
+ orphan_candidate_window_id,
+ workspaces_to_kill_after_adopt,
+ );
+ }
+ })));
}
- })));
- anyhow::Ok(())
+ Err(err) => {
+ log::error!("attaching {domain_name} for thread switch: {err:#}");
+ }
+ }
})
.detach();
context.invalidate();
diff --git a/wezterm-gui/src/termwindow/ui/context_menu.rs b/wezterm-gui/src/termwindow/ui/context_menu.rs
index e2ad1e52..6f076f02 100644
--- a/wezterm-gui/src/termwindow/ui/context_menu.rs
+++ b/wezterm-gui/src/termwindow/ui/context_menu.rs
@@ -778,7 +778,7 @@ fn menu_icon(icon: &str) -> Option<SvgIcon> {
"rectangle.split.2x1" => Some(SvgIcon::SplitHorizontal),
"sidebar.leading" => Some(SvgIcon::PanelLeft),
"square.and.pencil" => Some(SvgIcon::NotebookTabs),
- "server" => Some(SvgIcon::Server),
+ "server.rack" => Some(SvgIcon::Server),
"square.stack" => Some(SvgIcon::SquareStack),
"terminal" => Some(SvgIcon::Terminal),
"trash" => Some(SvgIcon::Trash2),