diff --git a/desktop/dock/src/view.rs b/desktop/dock/src/view.rs index 58807aea2..5a88a9361 100644 --- a/desktop/dock/src/view.rs +++ b/desktop/dock/src/view.rs @@ -773,6 +773,10 @@ impl DockView { } let custom = if single { self.content.header(&selected, window, cx) } else { None }; let fills = custom.is_some() && self.content.header_fills(&selected, cx); + // A custom header takes the tab's place, and its × with it: without + // one at the bar's end, a thread's own panel could only be closed + // from a right-click menu (Wayne, 19 Nov 2026). + let header_close = custom.is_some() && self.content.closable(&selected, cx); if let Some(custom) = custom { let press_panel = selected.clone(); bar = bar.child( @@ -843,6 +847,26 @@ impl DockView { if let Some(accessory) = self.content.accessory(&selected, window, cx) { bar = bar.child(accessory); } + if header_close { + let title = self.content.title(&selected, cx); + let close = selected.clone(); + bar = bar.child( + div() + .id(ElementId::Name(format!("dock-header-close-{}", group.id).into())) + .flex_none() + .size(px(24.)) + .flex() + .items_center() + .justify_center() + .rounded(px(6.)) + .cursor_pointer() + .hover(|s| s.bg(theme.tab_hover)) + .child(svg().path(Lucide::Close.path()).size(px(13.)).text_color(theme.secondary)) + .tooltip(move |window, cx| Tooltip::new(format!("Close {title}")).build(window, cx)) + .on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation()) + .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| this.model.update(cx, |m, cx| m.close(&close, cx)))), + ); + } bar } diff --git a/docs/guide.md b/docs/guide.md index 31b2ca978..04f80a40e 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -875,7 +875,8 @@ The icons down the right edge of the window open and close the thread's own panels: Highlights at the top, one for each panel its patches add, and Patches at the foot. To open a thread in a panel of its own, beside the one you're reading, right-click it in the list and pick Open in New -Panel. +Panel. The × at the end of its title bar closes it, and Move to Main +Panel, on the same right-click menu, brings it back to the main panel. A patch's panel follows the thread you pick, and steps aside for a thread that doesn't have it. To keep one in view while you work in another