From f6caf33e3463ce80af6720cf5dad71dfb8121f57 Mon Sep 17 00:00:00 2001 From: Fabrice Bellamy Date: Sat, 21 Feb 2026 22:24:16 +0100 Subject: [PATCH] ui tweaks for macOS --- src/main.rs | 2 +- src/ui/components/sidebar.rs | 12 +++++----- src/ui/rootview.rs | 43 +++++++++++++++++++----------------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/main.rs b/src/main.rs index b4cd353..896ef0b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,7 +57,7 @@ fn main() { title: Some("PicoForge".into()), appears_transparent: true, // TODO: This option needs to be tested and adjusted on macos - traffic_light_position: Some(gpui::point(px(12.0), px(12.0))), + traffic_light_position: Some(gpui::point(px(9.0), px(9.0))), }), // Render our own window decorations(shadows and resize attack area) for linux/bsd. diff --git a/src/ui/components/sidebar.rs b/src/ui/components/sidebar.rs index 5fae191..a8d9334 100644 --- a/src/ui/components/sidebar.rs +++ b/src/ui/components/sidebar.rs @@ -73,13 +73,11 @@ impl AppSidebar { .border_color(border_color) .w(width) .child({ - let header = h_flex() - .w_full() - .items_center() - .bg(sidebar_bg) - // .border_r_1() - // .border_color(border_color) - .pt_4(); + #[cfg(not(target_os = "macos"))] + let header = h_flex().w_full().items_center().bg(sidebar_bg).pt_4(); + + #[cfg(target_os = "macos")] + let header = h_flex().w_full().items_center().bg(sidebar_bg).pt_8(); let current_width = width; let t = ((current_width - px(48.)) / (px(255.) - px(48.))).clamp(0.0, 1.0); diff --git a/src/ui/rootview.rs b/src/ui/rootview.rs index af1af48..08e2071 100644 --- a/src/ui/rootview.rs +++ b/src/ui/rootview.rs @@ -137,26 +137,29 @@ impl Render for ApplicationRoot { .child( v_flex() .size_full() - .child( - TitleBar::new().bg(cx.theme().title_bar).child( - h_flex() - .w_full() - .justify_between() - .bg(cx.theme().title_bar) - .items_center() - .cursor(gpui::CursorStyle::OpenHand) - .child( - Button::new("sidebar_toggle") - .ghost() - .icon(IconName::PanelLeft) - .on_click(cx.listener(|this, _, _, _| { - this.is_sidebar_collapsed = - !this.is_sidebar_collapsed; - })) - .tooltip("Toggle Sidebar"), - ), - ), - ) + .child(TitleBar::new().bg(cx.theme().title_bar).child({ + #[cfg(not(target_os = "macos"))] + let container = h_flex(); + + #[cfg(target_os = "macos")] + let container = h_flex().ml(gpui::px(-72.)); + + container + .w_full() + .justify_between() + .bg(cx.theme().title_bar) + .items_center() + .cursor(gpui::CursorStyle::OpenHand) + .child( + Button::new("sidebar_toggle") + .ghost() + .icon(IconName::PanelLeft) + .on_click(cx.listener(|this, _, _, _| { + this.is_sidebar_collapsed = !this.is_sidebar_collapsed; + })) + .tooltip("Toggle Sidebar"), + ) + })) .child( v_flex() .min_h(px(0.))