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
Still, compatibility test, Add integrated title buttons to settings window
RoversXb303cf2cceeb
diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rsindex 74623cc0..c4d928d9 100644--- a/wezterm-gui/src/settings_window.rs+++ b/wezterm-gui/src/settings_window.rs@@ -27,9 +27,10 @@ use wezterm_font::{FontConfiguration, LoadedFont};use window::bitmaps::atlas::OutOfTextureSpace;use window::color::LinearRgba;use window::{- Appearance, Clipboard, Connection, ConnectionOps, Dimensions, KeyCode, KeyEvent, Modifiers,- MouseButtons, MouseCursor, MouseEvent, MouseEventKind, MousePress, RequestedWindowGeometry,- Window, WindowEvent, WindowOps,+ Appearance, Clipboard, Connection, ConnectionOps, Dimensions, IntegratedTitleButton,+ IntegratedTitleButtonStyle, KeyCode, KeyEvent, Modifiers, MouseButtons, MouseCursor,+ MouseEvent, MouseEventKind, MousePress, RequestedWindowGeometry, Window, WindowDecorations,+ WindowEvent, WindowOps, WindowState,};use crate::native_settings::{@@ -54,6 +55,12 @@ const SIDEBAR_LIST_TOP: f32 = 222.0;const CONTENT_TITLE_Y: f32 = 82.0;const CONTENT_SECTION_Y: f32 = 168.0;const CONTENT_RULE_Y: f32 = 202.0;+const SETTINGS_WINDOW_CHROME_HEIGHT: f32 = 58.0;+const SETTINGS_WINDOW_BUTTON_TOP_INSET: f32 = 14.0;+const SETTINGS_WINDOW_BUTTON_RIGHT_INSET: f32 = 18.0;+const SETTINGS_WINDOW_BUTTON_SIZE: f32 = 36.0;+const SETTINGS_WINDOW_BUTTON_GAP: f32 = 5.0;+const SETTINGS_WINDOW_BUTTON_ICON_SIZE: f32 = 24.0;thread_local! {static SETTINGS_WINDOW: RefCell<Option<Rc<RefCell<SettingsWindow>>>> = RefCell::new(None);@@ -223,6 +230,9 @@ impl SettingsSection {#[derive(Debug, Clone, Copy, PartialEq, Eq)]enum SettingsAction {+ WindowHide,+ WindowMaximize,+ WindowClose,Select(SettingsSection),OpenThinkTermConfigFile,OpenWezTermConfigFile,@@ -1038,6 +1048,7 @@ pub fn show() {struct SettingsWindow {window: Option<Window>,dimensions: Dimensions,+ window_state: WindowState,fonts: Rc<FontConfiguration>,ui_font: Rc<LoadedFont>,title_font: Rc<LoadedFont>,@@ -1096,6 +1107,7 @@ impl SettingsWindow {let settings = Rc::new(RefCell::new(Self {window: None,dimensions,+ window_state: WindowState::default(),fonts: Rc::clone(&fonts),ui_font,title_font,@@ -1180,8 +1192,13 @@ impl SettingsWindow {});Ok(true)}- WindowEvent::Resized { dimensions, .. } => {+ WindowEvent::Resized {+ dimensions,+ window_state,+ ..+ } => {self.dimensions = dimensions;+ self.window_state = window_state;if let Some(webgpu) = self.webgpu.as_ref() {webgpu.resize(dimensions);}@@ -1225,6 +1242,22 @@ impl SettingsWindow {match event.kind {MouseEventKind::Move => {+ if action.is_none() && self.settings_window_chrome_drag_hit(x, y) {+ window.set_window_drag_position(event.screen_coords);+ } else if let Some(target) =+ hit.filter(|target| target.action == SettingsAction::WindowMaximize)+ {+ let bounds: window::ScreenRect = euclid::rect(+ target.rect.origin.x as isize+ - (event.coords.x as isize - event.screen_coords.x),+ target.rect.origin.y as isize+ - (event.coords.y as isize - event.screen_coords.y),+ target.rect.size.width as isize,+ target.rect.size.height as isize,+ );+ window.set_maximize_button_position(bounds);+ }+if let Some(SettingsDrag::SidebarResize {start_x,start_width,@@ -1283,6 +1316,10 @@ impl SettingsWindow {None => {self.set_focused_input(None);self.ui.open_dropdown = None;+ if self.settings_window_chrome_drag_hit(x, y) {+ window.set_window_drag_position(event.screen_coords);+ window.request_drag_move();+ }}}window.invalidate();@@ -2098,6 +2135,25 @@ impl SettingsWindow {fn perform_action(&mut self, action: SettingsAction, window: &Window) {match action {+ SettingsAction::WindowHide => {+ self.ui.open_dropdown = None;+ window.hide();+ }+ SettingsAction::WindowMaximize => {+ self.ui.open_dropdown = None;+ if self+ .window_state+ .intersects(WindowState::MAXIMIZED | WindowState::FULL_SCREEN)+ {+ window.restore();+ } else {+ window.maximize();+ }+ }+ SettingsAction::WindowClose => {+ self.commit_focused_input();+ window.close();+ }SettingsAction::Select(section) => {self.commit_focused_input();self.selected = section;@@ -2618,10 +2674,140 @@ impl SettingsWindow {self.paint_background(&mut layers)?;self.paint_sidebar(&mut layers)?;self.paint_content(&mut layers)?;+ self.paint_window_chrome(&mut layers)?;++ Ok(())+ }++ fn settings_window_shows_window_buttons(&self) -> bool {+ if cfg!(target_os = "macos") {+ return false;+ }++ let config = configuration();+ config+ .window_decorations+ .contains(WindowDecorations::INTEGRATED_BUTTONS)+ && config.integrated_title_button_style != IntegratedTitleButtonStyle::MacOsNative+ && !config.integrated_title_buttons.is_empty()+ }++ fn settings_window_chrome_drag_hit(&self, x: f32, y: f32) -> bool {+ self.settings_window_shows_window_buttons()+ && x >= 0.0+ && x <= self.dimensions.pixel_width as f32+ && (0.0..=SETTINGS_WINDOW_CHROME_HEIGHT).contains(&y)+ }++ fn paint_window_chrome(+ &mut self,+ layers: &mut TripleLayerQuadAllocator<'_>,+ ) -> anyhow::Result<()> {+ if !self.settings_window_shows_window_buttons() {+ return Ok(());+ }++ let config = configuration();+ let mut right = self.dimensions.pixel_width as f32 - SETTINGS_WINDOW_BUTTON_RIGHT_INSET;+ let y = SETTINGS_WINDOW_BUTTON_TOP_INSET;+ for button in config.integrated_title_buttons.iter().rev() {+ right -= SETTINGS_WINDOW_BUTTON_SIZE;+ self.paint_window_chrome_button(layers, *button, right, y)?;+ right -= SETTINGS_WINDOW_BUTTON_GAP;+ }Ok(())}+ fn paint_window_chrome_button(+ &mut self,+ layers: &mut TripleLayerQuadAllocator<'_>,+ button: IntegratedTitleButton,+ x: f32,+ y: f32,+ ) -> anyhow::Result<()> {+ let action = match button {+ IntegratedTitleButton::Hide => SettingsAction::WindowHide,+ IntegratedTitleButton::Maximize => SettingsAction::WindowMaximize,+ IntegratedTitleButton::Close => SettingsAction::WindowClose,+ };+ let palette = self.palette();+ let button_rect = rect(+ x,+ y,+ SETTINGS_WINDOW_BUTTON_SIZE,+ SETTINGS_WINDOW_BUTTON_SIZE,+ );+ self.ui_context+ .push(button_rect, WidgetKind::Button, action);++ let hovered = self.ui.interaction.hovered == Some(action);+ let pressed = self.ui.interaction.pressed == Some(action);+ let close_button = button == IntegratedTitleButton::Close;+ let press_inset = if pressed { 1.0 } else { 0.0 };+ let visual_size = SETTINGS_WINDOW_BUTTON_SIZE - press_inset * 2.0;++ if hovered {+ let fill = if close_button {+ if pressed {+ LinearRgba::with_srgba(232, 17, 35, 209)+ } else {+ LinearRgba::with_srgba(232, 17, 35, 255)+ }+ } else if pressed {+ palette.control_pressed_bg+ } else {+ palette.control_hover_bg+ };+ let border = if close_button {+ LinearRgba::TRANSPARENT+ } else {+ palette.text.mul_alpha(if pressed { 0.52 } else { 0.38 })+ };+ self.draw_rounded_frame(+ layers,+ 1,+ x + press_inset,+ y + press_inset,+ visual_size,+ visual_size,+ fill,+ border,+ 999.0,+ )?;+ }++ let maximized = self+ .window_state+ .intersects(WindowState::MAXIMIZED | WindowState::FULL_SCREEN);+ let icon = match button {+ IntegratedTitleButton::Hide => SvgIcon::Minus,+ IntegratedTitleButton::Maximize if maximized => SvgIcon::Copy,+ IntegratedTitleButton::Maximize => SvgIcon::Square,+ IntegratedTitleButton::Close => SvgIcon::X,+ };+ let icon_size = if pressed {+ SETTINGS_WINDOW_BUTTON_ICON_SIZE - 1.0+ } else {+ SETTINGS_WINDOW_BUTTON_ICON_SIZE+ };+ let icon_color = if close_button && hovered {+ LinearRgba(1.0, 1.0, 1.0, 1.0)+ } else if hovered {+ palette.text+ } else {+ palette.muted_text+ };+ self.draw_svg_icon(+ layers,+ icon,+ x + press_inset + (visual_size - icon_size) / 2.0,+ y + press_inset + (visual_size - icon_size) / 2.0,+ icon_size,+ icon_color,+ )+ }+fn paint_background(&self, layers: &mut TripleLayerQuadAllocator<'_>) -> anyhow::Result<()> {let palette = self.palette();let width = self.dimensions.pixel_width as f32;diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rsindex 9e5c0cef..4d485050 100644--- a/wezterm-gui/src/termwindow/mouseevent.rs+++ b/wezterm-gui/src/termwindow/mouseevent.rs@@ -125,11 +125,10 @@ impl super::TermWindow {};sidebar_actions_width- + if self.right_sidebar_width() == 0- && self- .config- .window_decorations- .contains(WindowDecorations::INTEGRATED_BUTTONS)+ + if self+ .config+ .window_decorations+ .contains(WindowDecorations::INTEGRATED_BUTTONS)&& self.config.integrated_title_button_style!= IntegratedTitleButtonStyle::MacOsNative{diff --git a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rsindex 18f041f1..7af15cff 100644--- a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs+++ b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs@@ -243,18 +243,10 @@ impl crate::TermWindow {let mut action_right = row_right.saturating_sub(WINDOW_TAB_INSET + 2);if self.fancy_tab_bar_shows_window_buttons() {- let window_button_right = if self.right_sidebar_width() > 0 {- self.dimensions- .pixel_width- .saturating_sub(border.right.get() as usize)- .saturating_sub(WINDOW_TAB_INSET + 2)- } else {- action_right- };let window_button_left = self.paint_window_tab_window_buttons(layers,&mut ui_items,- window_button_right,+ action_right,content_row_y,content_row_height,button_size,@@ -262,9 +254,7 @@ impl crate::TermWindow {foreground,muted_fg,)?;- if self.right_sidebar_width() == 0 {- action_right = window_button_left;- }+ action_right = window_button_left;}if self.right_sidebar_width() > 0 {diff --git a/wezterm-gui/src/termwindow/ui/right_sidebar.rs b/wezterm-gui/src/termwindow/ui/right_sidebar.rsindex 9bb18686..5f1cd0cf 100644--- a/wezterm-gui/src/termwindow/ui/right_sidebar.rs+++ b/wezterm-gui/src/termwindow/ui/right_sidebar.rs@@ -3,7 +3,6 @@ use crate::termwindow::ui::icons::SvgIcon;use crate::termwindow::ui::tokens::{CAPSULE_BORDER_WIDTH, ICON_BUTTON_BORDER_WIDTH, SIDEBAR_ICON_GAP, SIDEBAR_INSET,SIDEBAR_RESIZE_HANDLE_WIDTH, SIDEBAR_ROW_RADIUS, WINDOW_TAB_ADD_BUTTON_RADIUS,- WINDOW_TAB_LEADING_ACTION_BUTTON_SIZE, WINDOW_TAB_LEADING_ACTION_GAP,};use crate::termwindow::{RightSidebarMode, RightSidebarSnippetField, RightSidebarSnippetView, TermWindowNotif, UIItem,@@ -19,7 +18,7 @@ use std::time::{Duration, Instant};use termwiz::input::{KeyCode as TermKeyCode, Modifiers as TermModifiers};use wezterm_font::LoadedFont;use window::color::LinearRgba;-use window::{Clipboard, IntegratedTitleButtonStyle, WindowDecorations, WindowOps};+use window::{Clipboard, WindowOps};const RIGHT_SIDEBAR_SECTION_GAP: usize = 12;const RIGHT_SIDEBAR_WIDTH_CELLS: usize = 34;@@ -113,22 +112,6 @@ impl crate::TermWindow {RIGHT_SIDEBAR_MAX_WIDTH.min((self.dimensions.pixel_width / 2).max(RIGHT_SIDEBAR_MIN_WIDTH))}- fn right_sidebar_window_button_reserved_width(&self) -> usize {- if cfg!(target_os = "macos")- || !self- .config- .window_decorations- .contains(WindowDecorations::INTEGRATED_BUTTONS)- || self.config.integrated_title_button_style == IntegratedTitleButtonStyle::MacOsNative- {- return 0;- }-- self.config.integrated_title_buttons.len()- * (WINDOW_TAB_LEADING_ACTION_BUTTON_SIZE + WINDOW_TAB_LEADING_ACTION_GAP / 2)- + WINDOW_TAB_LEADING_ACTION_GAP- }-pub fn set_right_sidebar_width(&mut self, width: usize) {self.right_sidebar_width =width.clamp(RIGHT_SIDEBAR_MIN_WIDTH, self.right_sidebar_max_width());@@ -709,13 +692,11 @@ impl crate::TermWindow {.min(top_bar_height).min(content_width).max(1);- let window_button_reserve = self.right_sidebar_window_button_reserved_width();let close_button_right_limit = rect.x.saturating_add(rect.width).saturating_sub(SIDEBAR_INSET)- .saturating_sub(close_button_size)- .saturating_sub(window_button_reserve);+ .saturating_sub(close_button_size);let close_button_x = content_x.saturating_add(content_width).saturating_sub(close_button_size)