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): give the overview's close button a standing surface
RoversX364961c92e23
diff --git a/wezterm-gui/src/termwindow/live_overview.rs b/wezterm-gui/src/termwindow/live_overview.rsindex 8123624d..048887a8 100644--- a/wezterm-gui/src/termwindow/live_overview.rs+++ b/wezterm-gui/src/termwindow/live_overview.rs@@ -7,10 +7,11 @@ use crate::termwindow::ui::icons::SvgIcon;use crate::termwindow::{TermWindow, TermWindowNotif};use crate::ui::anim::{self, Easing, Timeline};use crate::ui::{- draw_button_on_layer, draw_icon_button, draw_icon_button_on_layer, draw_scrollbar_on_layer,+ draw_button_on_layer, draw_icon_button, draw_scrollbar_on_layer,+ draw_styled_icon_button_on_layer,card_is_warm, card_rect, grid_card_width, precise_wheel_delta_pixels, row_fully_visible,row_visible, shared_grid_columns, wheel_delta_pixels, ButtonSpec, ButtonVariant, CardGrid,- ControlState, DrawContext, RowAlign,+ ControlState, DrawContext, IconButtonStyle, RowAlign,InteractionState, ScrollState, UiContext, UiPalette, UiTokens, WidgetKind,};use crate::workspace_threads;@@ -83,7 +84,18 @@ const TAB_PILL_FOLDED_DOTS: usize = 3;const TAB_PILL_OPEN_DELAY: Duration = Duration::from_millis(150);const TAB_PILL_CLOSE_DELAY: Duration = Duration::from_millis(200);const PREVIEW_RADIUS: f32 = 12.0;-const CLOSE_BUTTON_SIZE: f32 = 44.0;+/// The button that closes the overview: a 28pt circle whose right edge lands+/// on the page's right margin, so it shares a column edge with everything in+/// the list rather than hanging off the window corner.+const CLOSE_BUTTON_SIZE: f32 = 56.0;+/// It rides much nearer the top than the margin it keeps at the side. The+/// content area begins below the row the platform keeps for its window+/// controls, and the button cannot cross into that row -- a press there+/// resolves to the chrome's own hit target and never reaches this view -- so+/// this is as high as it goes. The gap that is left keeps it clear of the+/// integrated title buttons that occupy the right-hand end of that row on+/// Windows and Linux.+const CLOSE_BUTTON_TOP_INSET: f32 = 8.0;const CONFIRM_MIN_WIDTH: f32 = 640.0;const CONFIRM_MAX_WIDTH: f32 = 880.0;const CONFIRM_SIDE_MARGIN: f32 = 64.0;@@ -939,6 +951,9 @@ impl LiveOverviewView {if row_visible(heading_y, group_header_height, self.viewport) {let heading_text_y =heading_y + (group_header_height - group_line_height).max(0.0) / 2.0;+ // The close button ends the first title's line: it sits+ // on the same right margin and overlaps the band the title+ // is drawn in, so that title alone is measured short.let title_width = if layout.header_y == 0.0 {(content_width - ctx.px(CLOSE_BUTTON_SIZE + 20.0)).max(1.0)} else {@@ -1366,18 +1381,20 @@ impl LiveOverviewView {// button visible without hand-authoring a second control style.let pad = horizontal_page_pad(ctx, area);let close_size = ctx.px(CLOSE_BUTTON_SIZE);- draw_icon_button_on_layer(+ let top_inset = ctx.px(CLOSE_BUTTON_TOP_INSET);+ draw_styled_icon_button_on_layer(ctx,layers,&mut self.widgets,&self.interaction,palette,area.max_x() - pad - close_size,- area.origin.y + ctx.px(14.0),+ area.origin.y + top_inset,close_size,SvgIcon::X,OverviewAction::CloseOverview,2,+ IconButtonStyle::Floating,)}diff --git a/wezterm-gui/src/ui/widgets.rs b/wezterm-gui/src/ui/widgets.rsindex 1de2ef58..ae1bf8a8 100644--- a/wezterm-gui/src/ui/widgets.rs+++ b/wezterm-gui/src/ui/widgets.rs@@ -28,6 +28,10 @@ use window::RectF;/// house size and leaves 16 design px of slack.const BUTTON_TEXT_PAD: f32 = 20.0;const ICON_BUTTON_RADIUS: f32 = 8.0;+/// Side of the glyph inside a floating icon button, as a fraction of the+/// button. The cell-derived size below is tied to the terminal font, which+/// has nothing to say about a control that floats on a page of its own.+const FLOATING_ICON_RATIO: f32 = 0.5;/// Icon side length is derived from the (already DPI-aware) cell height, so/// only the padding and the clamp bounds are design pixels.const ICON_CELL_PADDING: f32 = 4.0;@@ -131,6 +135,19 @@ fn draw_button_with_layers<A: Copy + PartialEq>(Ok(())}+/// How an icon button paints when the pointer is nowhere near it.+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub(crate) enum IconButtonStyle {+ /// Icon alone until hovered, then a rounded-square surface. What a button+ /// in a row, a header or a toolbar wants: a standing fill on each of them+ /// would tile the strip with chips.+ Flat,+ /// A circle with a standing fill that brightens on hover. For a control+ /// floating alone on an open page, where a bare glyph has no edge, no+ /// neighbours and nothing about it that says it can be pressed.+ Floating,+}+/// A transparent square button containing a tinted SVG icon; background fades/// in on hover/press.pub(crate) fn draw_icon_button<A: Copy + PartialEq>(@@ -177,6 +194,39 @@ pub(crate) fn draw_icon_button_on_layer<A: Copy + PartialEq>(icon: SvgIcon,action: A,background_layer: usize,+) -> anyhow::Result<()> {+ draw_styled_icon_button_on_layer(+ ctx,+ layers,+ widgets,+ interaction,+ palette,+ x,+ y,+ size,+ icon,+ action,+ background_layer,+ IconButtonStyle::Flat,+ )+}++/// [`draw_icon_button_on_layer`] with the resting appearance chosen by the+/// caller. See [`IconButtonStyle`] for which one a given button wants.+#[allow(clippy::too_many_arguments)]+pub(crate) fn draw_styled_icon_button_on_layer<A: Copy + PartialEq>(+ ctx: &DrawContext,+ layers: &mut TripleLayerQuadAllocator<'_>,+ widgets: &mut UiContext<A>,+ interaction: &InteractionState<A>,+ palette: UiPalette,+ x: f32,+ y: f32,+ size: f32,+ icon: SvgIcon,+ action: A,+ background_layer: usize,+ style: IconButtonStyle,) -> anyhow::Result<()> {let rect = RectF::new(euclid::point2(x, y), euclid::size2(size, size));widgets.push(rect, WidgetKind::Button, action);@@ -187,24 +237,33 @@ pub(crate) fn draw_icon_button_on_layer<A: Copy + PartialEq>(} else if hovered {palette.control_hover_bg} else {- LinearRgba::TRANSPARENT+ match style {+ IconButtonStyle::Flat => LinearRgba::TRANSPARENT,+ IconButtonStyle::Floating => palette.control_bg,+ }};if bg.3 > 0.0 {- ctx.draw_rounded_rect(- layers,- background_layer,- x,- y,- size,- size,- bg,- ctx.px(ICON_BUTTON_RADIUS),- )?;+ let radius = match style {+ IconButtonStyle::Flat => ctx.px(ICON_BUTTON_RADIUS),+ IconButtonStyle::Floating => size / 2.0,+ };+ ctx.draw_rounded_rect(layers, background_layer, x, y, size, size, bg, radius)?;}- // cell_size already tracks the window DPI, so only the padding and the- // clamp bounds need converting from design pixels.- let icon_size = (ctx.metrics.cell_size.height as f32 + ctx.px(ICON_CELL_PADDING))- .clamp(ctx.px(ICON_MIN_SIZE), ctx.px(ICON_MAX_SIZE));+ let icon_size = match style {+ // cell_size already tracks the window DPI, so only the padding and the+ // clamp bounds need converting from design pixels.+ IconButtonStyle::Flat => (ctx.metrics.cell_size.height as f32+ + ctx.px(ICON_CELL_PADDING))+ .clamp(ctx.px(ICON_MIN_SIZE), ctx.px(ICON_MAX_SIZE)),+ IconButtonStyle::Floating => size * FLOATING_ICON_RATIO,+ };+ let resting_icon = match style {+ IconButtonStyle::Flat => palette.muted_text,+ // A step brighter than flat: the standing surface already carries some+ // of the contrast the glyph alone used to need, but muted on top of it+ // reads as a disabled control rather than a quiet one.+ IconButtonStyle::Floating => palette.secondary_text,+ };ctx.draw_svg_icon(layers,icon,@@ -214,7 +273,7 @@ pub(crate) fn draw_icon_button_on_layer<A: Copy + PartialEq>(if hovered || pressed {palette.text} else {- palette.muted_text+ resting_icon},)}