From 62028c792185e044a32224e9b89b35901cd31421 Mon Sep 17 00:00:00 2001 From: TomZz Date: Thu, 18 Jun 2026 08:15:06 +0800 Subject: [PATCH] feat: replace native title bar with custom TitleBar and integrate tab bar This commit removes the native OS title bar and introduces a cross-platform custom title bar using gpui-component's TitleBar. To optimize vertical screen space, the tab bar has been relocated into the newly created custom title bar. Fixes #37 --- src/app/startup.rs | 5 ++++- src/app/ui.rs | 13 +++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/startup.rs b/src/app/startup.rs index 32424b4..8e166ee 100644 --- a/src/app/startup.rs +++ b/src/app/startup.rs @@ -176,7 +176,10 @@ pub(crate) fn sync_macos_launch_environment() { pub(crate) fn sync_macos_launch_environment() {} pub(crate) fn open_main_window(cx: &mut App) { - let mut window_options = WindowOptions::default(); + let mut window_options = WindowOptions { + titlebar: Some(gpui_component::TitleBar::title_bar_options()), + ..Default::default() + }; #[cfg(not(target_os = "macos"))] if let Ok(img) = image::load_from_memory(include_bytes!("../../assets/icons/ashell.png")) { diff --git a/src/app/ui.rs b/src/app/ui.rs index fe54ae3..169aeb0 100644 --- a/src/app/ui.rs +++ b/src/app/ui.rs @@ -2431,7 +2431,6 @@ impl Render for Ashell { .size_full() .relative() .overflow_hidden() - .child(self.render_tab_bar(cx)) .child(body_panel), ), ) @@ -2452,7 +2451,6 @@ impl Render for Ashell { .size_full() .relative() .overflow_hidden() - .child(self.render_tab_bar(cx)) .child(body_panel), ); @@ -2463,7 +2461,7 @@ impl Render for Ashell { .into_any_element() }; - div() + v_flex() .id("ashell-root") .size_full() .bg(cx.theme().background) @@ -2495,7 +2493,14 @@ impl Render for Ashell { this.close_tab(active_id, cx); } })) - .child(workspace) + .child( + gpui_component::TitleBar::new().child( + div().flex().items_center().w_full().child(self.render_tab_bar(cx)), + ), + ) + .child( + div().flex_1().min_h_0().child(workspace), + ) .children(Root::render_dialog_layer(window, cx)) .children(Root::render_sheet_layer(window, cx)) .when_some(self.sftp_context_menu.clone(), |this, menu| {