mirror of
https://github.com/rust-kotlin/ashell.git
synced 2026-09-22 00:00:59 +00:00
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
This commit is contained in:
+4
-1
@@ -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")) {
|
||||
|
||||
+9
-4
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user