Skip to content

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.

compatibility test Account for right sidebar with integrated buttons

RoversX6cfbbc374dfb
diff --git a/wezterm-gui/src/settings_window.rs b/wezterm-gui/src/settings_window.rs
index c4d928d9..581d8235 100644
--- a/wezterm-gui/src/settings_window.rs
+++ b/wezterm-gui/src/settings_window.rs
@@ -55,12 +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;
+const SETTINGS_WINDOW_CHROME_HEIGHT: f32 = 74.0;
+const SETTINGS_WINDOW_BUTTON_TOP_INSET: f32 = 18.0;
+const SETTINGS_WINDOW_BUTTON_RIGHT_INSET: f32 = 22.0;
+const SETTINGS_WINDOW_BUTTON_SIZE: f32 = 52.0;
+const SETTINGS_WINDOW_BUTTON_GAP: f32 = 4.0;
+const SETTINGS_WINDOW_BUTTON_ICON_SIZE: f32 = 26.0;
thread_local! {
static SETTINGS_WINDOW: RefCell<Option<Rc<RefCell<SettingsWindow>>>> = RefCell::new(None);
@@ -1151,8 +1151,11 @@ impl SettingsWindow {
window.set_title("ThinkTerm Settings");
let webgpu = Rc::new(WebGpuState::new(&window, dimensions, &config).await?);
+ webgpu.resize(dimensions);
+ let dimensions = *webgpu.dimensions.borrow();
{
let mut settings = settings.borrow_mut();
+ settings.dimensions = dimensions;
settings.created(RenderContext::WebGpu(Rc::clone(&webgpu)))?;
settings.webgpu.replace(webgpu);
settings.window.replace(window.clone());
diff --git a/wezterm-gui/src/termwindow/mouseevent.rs b/wezterm-gui/src/termwindow/mouseevent.rs
index 4d485050..9e5c0cef 100644
--- a/wezterm-gui/src/termwindow/mouseevent.rs
+++ b/wezterm-gui/src/termwindow/mouseevent.rs
@@ -125,10 +125,11 @@ impl super::TermWindow {
};
sidebar_actions_width
- + if self
- .config
- .window_decorations
- .contains(WindowDecorations::INTEGRATED_BUTTONS)
+ + if self.right_sidebar_width() == 0
+ && 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.rs
index 7af15cff..18f041f1 100644
--- a/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs
+++ b/wezterm-gui/src/termwindow/render/fancy_tab_bar.rs
@@ -243,10 +243,18 @@ 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,
- action_right,
+ window_button_right,
content_row_y,
content_row_height,
button_size,
@@ -254,7 +262,9 @@ impl crate::TermWindow {
foreground,
muted_fg,
)?;
- action_right = window_button_left;
+ if self.right_sidebar_width() == 0 {
+ 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.rs
index 5f1cd0cf..9bb18686 100644
--- a/wezterm-gui/src/termwindow/ui/right_sidebar.rs
+++ b/wezterm-gui/src/termwindow/ui/right_sidebar.rs
@@ -3,6 +3,7 @@ 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,
@@ -18,7 +19,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, WindowOps};
+use window::{Clipboard, IntegratedTitleButtonStyle, WindowDecorations, WindowOps};
const RIGHT_SIDEBAR_SECTION_GAP: usize = 12;
const RIGHT_SIDEBAR_WIDTH_CELLS: usize = 34;
@@ -112,6 +113,22 @@ 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());
@@ -692,11 +709,13 @@ 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(close_button_size)
+ .saturating_sub(window_button_reserve);
let close_button_x = content_x
.saturating_add(content_width)
.saturating_sub(close_button_size)