diff --git a/crates/terminal_view/src/terminal_panel.rs b/crates/terminal_view/src/terminal_panel.rs index 90334f9449..766736d70e 100644 --- a/crates/terminal_view/src/terminal_panel.rs +++ b/crates/terminal_view/src/terminal_panel.rs @@ -68,6 +68,10 @@ impl TerminalPanel { .with_child(Pane::render_tab_bar_button( 0, "icons/plus_12.svg", + Some(( + "New Terminal".into(), + Some(Box::new(workspace::NewTerminal)), + )), cx, move |_, cx| { let this = this.clone(); @@ -88,6 +92,7 @@ impl TerminalPanel { } else { "icons/maximize_8.svg" }, + Some(("Toggle Zoom".into(), Some(Box::new(workspace::ToggleZoom)))), cx, move |pane, cx| pane.toggle_zoom(&Default::default(), cx), None, diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index 4302c6b390..26f3d17453 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -285,6 +285,7 @@ impl Pane { .with_child(Self::render_tab_bar_button( 0, "icons/plus_12.svg", + Some(("New...".into(), None)), cx, |pane, cx| pane.deploy_new_menu(cx), pane.tab_bar_context_menu @@ -293,6 +294,7 @@ impl Pane { .with_child(Self::render_tab_bar_button( 1, "icons/split_12.svg", + Some(("Split Pane".into(), None)), cx, |pane, cx| pane.deploy_split_menu(cx), pane.tab_bar_context_menu @@ -305,6 +307,7 @@ impl Pane { } else { "icons/maximize_8.svg" }, + Some(("Toggle Zoom".into(), Some(Box::new(ToggleZoom)))), cx, move |pane, cx| pane.toggle_zoom(&Default::default(), cx), None, @@ -1589,29 +1592,37 @@ impl Pane { pub fn render_tab_bar_button)>( index: usize, icon: &'static str, + tooltip: Option<(String, Option>)>, cx: &mut ViewContext, on_click: F, context_menu: Option>, ) -> AnyElement { enum TabBarButton {} + let mut button = MouseEventHandler::::new(index, cx, |mouse_state, cx| { + let theme = &settings::get::(cx).theme.workspace.tab_bar; + let style = theme.pane_button.style_for(mouse_state, false); + Svg::new(icon) + .with_color(style.color) + .constrained() + .with_width(style.icon_width) + .aligned() + .constrained() + .with_width(style.button_width) + .with_height(style.button_width) + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_click(MouseButton::Left, move |_, pane, cx| on_click(pane, cx)) + .into_any(); + if let Some((tooltip, action)) = tooltip { + let tooltip_style = settings::get::(cx).theme.tooltip.clone(); + button = button + .with_tooltip::(index, tooltip, action, tooltip_style, cx) + .into_any(); + } + Stack::new() - .with_child( - MouseEventHandler::::new(index, cx, |mouse_state, cx| { - let theme = &settings::get::(cx).theme.workspace.tab_bar; - let style = theme.pane_button.style_for(mouse_state, false); - Svg::new(icon) - .with_color(style.color) - .constrained() - .with_width(style.icon_width) - .aligned() - .constrained() - .with_width(style.button_width) - .with_height(style.button_width) - }) - .with_cursor_style(CursorStyle::PointingHand) - .on_click(MouseButton::Left, move |_, pane, cx| on_click(pane, cx)), - ) + .with_child(button) .with_children( context_menu.map(|menu| ChildView::new(&menu, cx).aligned().bottom().right()), )