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
feat(gui): pick a shell from the new tab button's right-click menu
RoversX62b22f988678
diff --git a/thinkterm-i18n/i18n/de-DE.ftl b/thinkterm-i18n/i18n/de-DE.ftlindex d1e6fae7..32de920d 100644--- a/thinkterm-i18n/i18n/de-DE.ftl+++ b/thinkterm-i18n/i18n/de-DE.ftl@@ -426,6 +426,8 @@ menu-close-tabs-right = Tabs rechts schließenmenu-close-other-tabs = Andere Tabs schließenmenu-move-tab-left = Tab nach links verschiebenmenu-move-tab-right = Tab nach rechts verschieben+menu-new-tab-with = Neuer Tab mit+menu-new-tab-more = Weitere…menu-new-terminal-tab-right = Neuer Terminal-Tab rechtsmenu-zoom-pane = Pane vergrößernmenu-copy = Kopierendiff --git a/thinkterm-i18n/i18n/en-US.ftl b/thinkterm-i18n/i18n/en-US.ftlindex 5edf6dde..ead7ddba 100644--- a/thinkterm-i18n/i18n/en-US.ftl+++ b/thinkterm-i18n/i18n/en-US.ftl@@ -426,6 +426,8 @@ menu-close-tabs-right = Close Tabs to Rightmenu-close-other-tabs = Close Other Tabsmenu-move-tab-left = Move Tab Leftmenu-move-tab-right = Move Tab Right+menu-new-tab-with = New Tab With+menu-new-tab-more = More…menu-new-terminal-tab-right = New Terminal Tab to Rightmenu-zoom-pane = Zoom Panemenu-copy = Copydiff --git a/thinkterm-i18n/i18n/fr-FR.ftl b/thinkterm-i18n/i18n/fr-FR.ftlindex f24e5f41..80a559cf 100644--- a/thinkterm-i18n/i18n/fr-FR.ftl+++ b/thinkterm-i18n/i18n/fr-FR.ftl@@ -426,6 +426,8 @@ menu-close-tabs-right = Fermer les onglets à droitemenu-close-other-tabs = Fermer les autres ongletsmenu-move-tab-left = Déplacer l’onglet à gauchemenu-move-tab-right = Déplacer l’onglet à droite+menu-new-tab-with = Nouvel onglet avec+menu-new-tab-more = Plus…menu-new-terminal-tab-right = Nouvel onglet de terminal à droitemenu-zoom-pane = Agrandir le voletmenu-copy = Copierdiff --git a/thinkterm-i18n/i18n/ja-JP.ftl b/thinkterm-i18n/i18n/ja-JP.ftlindex d0fe817a..a56a748e 100644--- a/thinkterm-i18n/i18n/ja-JP.ftl+++ b/thinkterm-i18n/i18n/ja-JP.ftl@@ -417,6 +417,8 @@ menu-close-tabs-right = 右側のタブを閉じるmenu-close-other-tabs = 他のタブを閉じるmenu-move-tab-left = タブを左へ移動menu-move-tab-right = タブを右へ移動+menu-new-tab-with = 新しいタブで開く+menu-new-tab-more = その他…menu-new-terminal-tab-right = 右側に新しいターミナルタブmenu-zoom-pane = ペインを拡大menu-copy = コピーdiff --git a/thinkterm-i18n/i18n/zh-CN.ftl b/thinkterm-i18n/i18n/zh-CN.ftlindex dd949a0c..04ac1f6e 100644--- a/thinkterm-i18n/i18n/zh-CN.ftl+++ b/thinkterm-i18n/i18n/zh-CN.ftl@@ -417,6 +417,8 @@ menu-close-tabs-right = 关闭右侧标签页menu-close-other-tabs = 关闭其他标签页menu-move-tab-left = 标签页左移menu-move-tab-right = 标签页右移+menu-new-tab-with = 新建标签页+menu-new-tab-more = 更多…menu-new-terminal-tab-right = 在右侧新建终端标签页menu-zoom-pane = 放大窗格menu-copy = 复制diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rsindex d4d942d9..d734b3f1 100644--- a/wezterm-gui/src/termwindow/mouseevent.rs+++ b/wezterm-gui/src/termwindow/mouseevent.rs@@ -8471,18 +8471,106 @@ impl super::TermWindow {}fn mouse_event_local_new_tab_button(&mut self, event: MouseEvent, context: &dyn WindowOps) {- if event.kind == WMEK::Press(MousePress::Left) {- self.spawn_command(- &SpawnCommand {- domain: crate::local_sessions::local_spawn_domain(),- ..SpawnCommand::default()- },- crate::spawn::SpawnWhere::NewTab,- );+ match event.kind {+ WMEK::Press(MousePress::Left) => {+ self.spawn_command(+ &SpawnCommand {+ domain: crate::local_sessions::local_spawn_domain(),+ ..SpawnCommand::default()+ },+ crate::spawn::SpawnWhere::NewTab,+ );+ }+ // What the menu picks runs as a key assignment, which needs a+ // pane: a window with none would drop the choice.+ WMEK::Press(MousePress::Right) if self.get_active_pane_or_overlay().is_some() => {+ self.show_term_context_menu(context, event.coords, self.new_tab_shell_menu_items());+ }+ _ => {}}context.set_cursor(Some(MouseCursor::Arrow));}+ /// Whether the window's terminal runs on this machine, in process or in+ /// the local session server, so that the shells found here are the ones+ /// a new tab beside it would run. Not without a terminal: what the menu+ /// picks runs as a key assignment, which needs a pane.+ fn active_pane_is_on_this_machine(&self) -> bool {+ let Some(pane) = self.get_active_pane_or_overlay() else {+ return false;+ };+ Mux::get().get_domain(pane.domain_id()).is_some_and(|domain| {+ domain.downcast_ref::<mux::domain::LocalDomain>().is_some()+ || crate::local_sessions::is_host_domain_id(domain.domain_id())+ })+ }++ /// What a right click on the new tab button offers: a new tab in each+ /// shell found on this machine, the one chosen in Settings ticked, then+ /// the configuration's own launch_menu, then the launcher this click+ /// used to open, for its domains.+ fn new_tab_shell_menu_items(&self) -> Vec<ContextMenuItem> {+ let domain = crate::local_sessions::local_spawn_domain();+ let chosen = crate::native_settings::load_shared()+ .terminal+ .default_shell+ .clone();+ let mut items = vec![ContextMenuItem::section_header(crate::i18n::tr(+ "menu-new-tab-with",+ ))];+ for shell in crate::shell_catalog::discover() {+ let checked = chosen.as_ref() == Some(&shell.argv);+ items.push(+ ContextMenuItem::item_with_icon(+ shell.label,+ ContextMenuIcon::Terminal,+ KeyAssignment::SpawnCommandInNewTab(SpawnCommand {+ args: Some(shell.argv),+ domain: domain.clone(),+ ..SpawnCommand::default()+ }),+ )+ .checked(checked),+ );+ }+ let launch_menu: Vec<_> = self+ .config+ .launch_menu+ .iter()+ .filter_map(|command| {+ let label = command+ .label+ .clone()+ .or_else(|| {+ command+ .args+ .as_ref()+ .filter(|args| !args.is_empty())+ .map(|args| args.join(" "))+ })+ .or_else(|| match &command.domain {+ SpawnTabDomain::DomainName(name) => Some(name.clone()),+ _ => None,+ })?;+ Some(ContextMenuItem::item_with_icon(+ label,+ ContextMenuIcon::Terminal,+ KeyAssignment::SpawnCommandInNewTab(command.clone()),+ ))+ })+ .collect();+ if !launch_menu.is_empty() {+ items.push(ContextMenuItem::Separator);+ items.extend(launch_menu);+ }+ items.push(ContextMenuItem::Separator);+ items.push(ContextMenuItem::item(+ crate::i18n::tr("menu-new-tab-more"),+ KeyAssignment::ShowLauncher,+ ));+ items+ }+fn do_new_tab_button_click(&mut self, button: MousePress) {let pane = match self.get_active_pane_or_overlay() {Some(pane) => pane,@@ -8736,7 +8824,15 @@ impl super::TermWindow {);}TabBarItem::NewTabButton { .. } => {- self.do_new_tab_button_click(MousePress::Right);+ if self.active_pane_is_on_this_machine() {+ self.show_term_context_menu(+ context,+ event.coords,+ self.new_tab_shell_menu_items(),+ );+ } else {+ self.do_new_tab_button_click(MousePress::Right);+ }}TabBarItem::None| TabBarItem::LeftStatus