fix(ui): center the macOS traffic lights in the 40px title bar
gpui-component places them at (9, 9), which centers the old 16pt buttons in its 34px bar. Our bar is 40px and the buttons are 14pt since macOS 26, so they sat 3px high. Main and call windows now share a window_options() that centers them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -347,7 +347,7 @@ impl CallWindows {
347
347
self.stage_opening = true;
348
348
let controller = cx.entity();
349
349
let app = self.app.clone();
350
let mut options = gpui_kit::component::TitleBar::window_options();
350
let mut options = crate::views::title_bar::window_options();
351
351
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(
352
352
None,
353
353
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),
@@ -347,7 +347,7 @@ impl CallWindows {347
self.stage_opening = true;347
self.stage_opening = true;348
let controller = cx.entity();348
let controller = cx.entity();349
let app = self.app.clone();349
let app = self.app.clone();350
let mut options = gpui_kit::component::TitleBar::window_options();350
let mut options = crate::views::title_bar::window_options();351
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(351
options.window_bounds = Some(WindowBounds::Windowed(Bounds::centered(352
None,352
None,353
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),353
size(px(CALL_WINDOW_SIZE.0), px(CALL_WINDOW_SIZE.1)),@@ -30,7 +30,6 @@ use std::sync::Arc;
30
30
use std::time::Duration;
31
31
32
32
use directories::ProjectDirs;
33
use gpui_kit::component::TitleBar;
34
33
use gpui_kit::*;
35
34
use store::Store;
36
35
@@ -163,7 +162,7 @@ fn transport(
163
162
164
163
fn main_window_options(cx: &App) -> WindowOptions {
165
164
let bounds = Bounds::centered(None, size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), cx);
166
let mut options = TitleBar::window_options();
165
let mut options = views::title_bar::window_options();
167
166
options.window_bounds = Some(WindowBounds::Windowed(bounds));
168
167
options.window_min_size = Some(size(px(WINDOW_MIN_WIDTH), px(WINDOW_MIN_HEIGHT)));
169
168
options.app_id = Some(LINUX_APP_ID.to_owned());
@@ -30,7 +30,6 @@ use std::sync::Arc;30
use std::time::Duration;30
use std::time::Duration;31
31
32
use directories::ProjectDirs;32
use directories::ProjectDirs;33
use gpui_kit::component::TitleBar;34
use gpui_kit::*;33
use gpui_kit::*;35
use store::Store;34
use store::Store;36
35
@@ -163,7 +162,7 @@ fn transport(163
162
164
fn main_window_options(cx: &App) -> WindowOptions {163
fn main_window_options(cx: &App) -> WindowOptions {165
let bounds = Bounds::centered(None, size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), cx);164
let bounds = Bounds::centered(None, size(px(WINDOW_WIDTH), px(WINDOW_HEIGHT)), cx);166
let mut options = TitleBar::window_options();165
let mut options = views::title_bar::window_options();167
options.window_bounds = Some(WindowBounds::Windowed(bounds));166
options.window_bounds = Some(WindowBounds::Windowed(bounds));168
options.window_min_size = Some(size(px(WINDOW_MIN_WIDTH), px(WINDOW_MIN_HEIGHT)));167
options.window_min_size = Some(size(px(WINDOW_MIN_WIDTH), px(WINDOW_MIN_HEIGHT)));169
options.app_id = Some(LINUX_APP_ID.to_owned());168
options.app_id = Some(LINUX_APP_ID.to_owned());@@ -21,6 +21,21 @@ const SHORTCUT_MIN_WIDTH: f32 = 200.;
21
21
const SEARCH_HINT: &str = "Search chats, people and channels";
22
22
const SHORTCUT_HINT: &str = "Ctrl K";
23
23
const APP_ICON_SIZE: f32 = 18.;
24
/// Frame of one macOS traffic light button (14 x 14 since macOS 26).
25
const TRAFFIC_LIGHT_SIZE: f32 = 14.;
26
const TRAFFIC_LIGHT_LEFT: f32 = 9.;
27
28
/// Base options for a window that renders a [`TitleBar`] of [`TITLE_BAR_HEIGHT`], with the macOS traffic lights centered in it.
29
pub fn window_options() -> WindowOptions {
30
let mut options = TitleBar::window_options();
31
if let Some(titlebar) = options.titlebar.as_mut() {
32
titlebar.traffic_light_position = Some(point(
33
px(TRAFFIC_LIGHT_LEFT),
34
px((TITLE_BAR_HEIGHT - TRAFFIC_LIGHT_SIZE) / 2.),
35
));
36
}
37
options
38
}
24
39
25
40
pub fn app_icon_image(app_icon: AppIcon) -> Arc<Image> {
26
41
static IMAGES: [OnceLock<Arc<Image>>; AppIcon::ALL.len()] =
@@ -21,6 +21,21 @@ const SHORTCUT_MIN_WIDTH: f32 = 200.;21
const SEARCH_HINT: &str = "Search chats, people and channels";21
const SEARCH_HINT: &str = "Search chats, people and channels";22
const SHORTCUT_HINT: &str = "Ctrl K";22
const SHORTCUT_HINT: &str = "Ctrl K";23
const APP_ICON_SIZE: f32 = 18.;23
const APP_ICON_SIZE: f32 = 18.;24
/// Frame of one macOS traffic light button (14 x 14 since macOS 26).25
const TRAFFIC_LIGHT_SIZE: f32 = 14.;26
const TRAFFIC_LIGHT_LEFT: f32 = 9.;27
28
/// Base options for a window that renders a [`TitleBar`] of [`TITLE_BAR_HEIGHT`], with the macOS traffic lights centered in it.29
pub fn window_options() -> WindowOptions {30
let mut options = TitleBar::window_options();31
if let Some(titlebar) = options.titlebar.as_mut() {32
titlebar.traffic_light_position = Some(point(33
px(TRAFFIC_LIGHT_LEFT),34
px((TITLE_BAR_HEIGHT - TRAFFIC_LIGHT_SIZE) / 2.),35
));36
}37
options38
}24
39
25
pub fn app_icon_image(app_icon: AppIcon) -> Arc<Image> {40
pub fn app_icon_image(app_icon: AppIcon) -> Arc<Image> {26
static IMAGES: [OnceLock<Arc<Image>>; AppIcon::ALL.len()] =41
static IMAGES: [OnceLock<Arc<Image>>; AppIcon::ALL.len()] =