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.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
fix(gui): keep the drawn context menu working without a terminal
RoversX91b1ef5e5663
diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rsindex abc7717b..c1f2e4d0 100644--- a/wezterm-gui/src/termwindow/mouseevent.rs+++ b/wezterm-gui/src/termwindow/mouseevent.rs@@ -2335,9 +2335,7 @@ impl super::TermWindow {return;}- // The command palette owns all pointer traffic while open. Dispatched- // before the pane-dependent context-menu branch so it also works when- // there is no active pane (content view foreground).+ // The command palette owns all pointer traffic while open.if self.mouse_event_command_palette(&event, context) {self.release_pointer_ownership(&event);return;@@ -2348,15 +2346,17 @@ impl super::TermWindow {return;}- if let Some(pane) = pane.as_ref() {- if self.mouse_event_context_menu(&event, pane, context) {- self.release_pointer_ownership(&event);- return;- }- } else if matches!(- self.current_mouse_capture,- Some(MouseCapture::TerminalPane(_))- ) {+ // Not only over a terminal: a menu also opens over a page with none.+ if self.mouse_event_context_menu(&event, context) {+ self.release_pointer_ownership(&event);+ return;+ }+ if pane.is_none()+ && matches!(+ self.current_mouse_capture,+ Some(MouseCapture::TerminalPane(_))+ )+ {self.current_mouse_capture = None;}diff --git a/wezterm-gui/src/termwindow/ui/context_menu.rs b/wezterm-gui/src/termwindow/ui/context_menu.rsindex c649d989..4088fe5d 100644--- a/wezterm-gui/src/termwindow/ui/context_menu.rs+++ b/wezterm-gui/src/termwindow/ui/context_menu.rs@@ -9,9 +9,7 @@ use ::window::{MousePress, WindowOps,};use anyhow::Context;-use mux::pane::Pane;use std::rc::Rc;-use std::sync::Arc;use wezterm_font::LoadedFont;// Design pixels (2x macOS backing), scaled via ui_px/ui_f32 like the rest@@ -664,7 +662,6 @@ impl crate::TermWindow {pub(crate) fn mouse_event_context_menu(&mut self,event: &MouseEvent,- pane: &Arc<dyn Pane>,context: &dyn WindowOps,) -> bool {let Some(menu) = self.context_menu.as_mut() else {@@ -699,8 +696,12 @@ impl crate::TermWindow {context.invalidate();match action {ContextMenuAction::KeyAssignment(action) => {- if let Err(err) = self.perform_key_assignment(pane, &action) {- log::error!("context menu action failed: {err:#}");+ if let Some(pane) = self.pane_for_key_bindings() {+ if let Err(err) = self.perform_key_assignment(&pane, &action) {+ log::error!("context menu action failed: {err:#}");+ }+ } else {+ log::warn!("context menu action with no pane: {action:?}");}}ContextMenuAction::ApplicationAction(action_id) => {@@ -723,10 +724,11 @@ impl crate::TermWindow {self.dismiss_fallback_context_menu();context.invalidate();// A right click goes on to open the menu of whatever it is on- // -- a tab, a sidebar row, or a terminal set to show its menu --- // where it is. One on a terminal that would paste or copy- // only closes this one.- let on_terminal = self.resolve_ui_item(event).is_none();+ // -- a tab, a sidebar row, a page, or a terminal set to show+ // its menu -- where it is. One on a terminal that would paste+ // or copy only closes this one.+ let on_terminal =+ !self.content_view_foreground() && self.resolve_ui_item(event).is_none();if !on_terminal|| crate::termwindow::mouseevent::right_click_mode(event.modifiers)== crate::native_settings::NativeRightClick::Menu