add per-tab sidebar toggle buttons to dock
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

This commit is contained in:
2026-11-14 19:47:31 +07:00
parent c1892dc568
commit 7f98715eb9
3 changed files with 59 additions and 22 deletions
Generated
+14 -14
View File
@@ -1579,7 +1579,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -3059,7 +3059,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-core" name = "gpui-native-core"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"cpal", "cpal",
"flume 0.12.0", "flume 0.12.0",
@@ -3075,7 +3075,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-data" name = "gpui-native-data"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"gpui", "gpui",
"gpui-native-core", "gpui-native-core",
@@ -3087,7 +3087,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-editor" name = "gpui-native-editor"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"gpui", "gpui",
"gpui-native-core", "gpui-native-core",
@@ -3106,7 +3106,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-icons" name = "gpui-native-icons"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"gpui", "gpui",
@@ -3115,7 +3115,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-kit" name = "gpui-native-kit"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"gpui", "gpui",
"gpui-native-core", "gpui-native-core",
@@ -3129,7 +3129,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-layout" name = "gpui-native-layout"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"gpui", "gpui",
"gpui-native-core", "gpui-native-core",
@@ -3142,7 +3142,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-theme" name = "gpui-native-theme"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-channel", "async-channel",
@@ -3163,7 +3163,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui-native-utils" name = "gpui-native-utils"
version = "0.1.0" version = "0.1.0"
source = "git+https://git.reya.info/reya/gpui-native-kit?rev=bf8a92a133ac2066eb7b6fda7958d19233599923#bf8a92a133ac2066eb7b6fda7958d19233599923" source = "git+https://git.reya.info/reya/gpui-native-kit?rev=33f8856bc2332c426e90f5392b3f0e50d711ea05#33f8856bc2332c426e90f5392b3f0e50d711ea05"
dependencies = [ dependencies = [
"gpui", "gpui",
"gpui-native-theme", "gpui-native-theme",
@@ -5940,7 +5940,7 @@ dependencies = [
"once_cell", "once_cell",
"socket2", "socket2",
"tracing", "tracing",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -6438,7 +6438,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -6506,7 +6506,7 @@ dependencies = [
"security-framework", "security-framework",
"security-framework-sys", "security-framework-sys",
"webpki-root-certs", "webpki-root-certs",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -7382,7 +7382,7 @@ dependencies = [
"getrandom 0.4.3", "getrandom 0.4.3",
"once_cell", "once_cell",
"rustix", "rustix",
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
@@ -8575,7 +8575,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.61.2",
] ]
[[package]] [[package]]
+1 -1
View File
@@ -13,7 +13,7 @@ gpui = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503de
gpui_platform = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc", features = ["font-kit"] } gpui_platform = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc", features = ["font-kit"] }
reqwest_client = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc" } reqwest_client = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc" }
gpui-native-kit = { git = "https://git.reya.info/reya/gpui-native-kit", rev = "bf8a92a133ac2066eb7b6fda7958d19233599923", features = ["layout", "editor"] } gpui-native-kit = { git = "https://git.reya.info/reya/gpui-native-kit", rev = "33f8856bc2332c426e90f5392b3f0e50d711ea05", features = ["layout", "editor"] }
settings = { path = "crates/settings" } settings = { path = "crates/settings" }
signed_app = { path = "crates/signed_app" } signed_app = { path = "crates/signed_app" }
+44 -7
View File
@@ -6,10 +6,11 @@ use gpui::{
AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _,
Render, Styled as _, Subscription, Window, div, Render, Styled as _, Subscription, Window, div,
}; };
use gpui_native_kit::common::h_flex; use gpui_native_kit::button::{Button, ButtonVariant};
use gpui_native_kit::common::{Sizable as _, h_flex};
use gpui_native_kit::icons::IconRole; use gpui_native_kit::icons::IconRole;
use gpui_native_kit::layout::dock::{Dock, DockSidebar, DockState}; use gpui_native_kit::layout::dock::{Dock, DockSidebar, DockState};
use gpui_native_kit::layout::shell::{LayoutState, Shell, SidebarToggles}; use gpui_native_kit::layout::shell::{LayoutState, Shell};
use gpui_native_kit::layout::window_controls::{TRAFFIC_LIGHT_PAD, titlebar_strip}; use gpui_native_kit::layout::window_controls::{TRAFFIC_LIGHT_PAD, titlebar_strip};
use gpui_native_kit::theme::ActiveTheme as _; use gpui_native_kit::theme::ActiveTheme as _;
use gpui_native_kit::toast::Toast; use gpui_native_kit::toast::Toast;
@@ -35,10 +36,6 @@ impl AppRoot {
let dock = DockState::new(cx); let dock = DockState::new(cx);
let layout = LayoutState::new(cx); let layout = LayoutState::new(cx);
layout.update(cx, |layout, cx| {
layout.set_sidebar_toggles(SidebarToggles::Tabbar, cx);
});
dock.update(cx, |dock, cx| { dock.update(cx, |dock, cx| {
dock.register_panel("welcome", |_, cx| { dock.register_panel("welcome", |_, cx| {
cx.new(|_| PlaceholderView::new("Welcome")) cx.new(|_| PlaceholderView::new("Welcome"))
@@ -114,6 +111,11 @@ impl Render for AppRoot {
let left_visible = layout.is_left_sidebar_visible(); let left_visible = layout.is_left_sidebar_visible();
let sidebar_width = layout.left_sidebar_width(); let sidebar_width = layout.left_sidebar_width();
let repo_active =
self.dock.read(cx).active_panel().is_some_and(|panel| {
panel.starts_with("repo:") || panel.starts_with("repo-local:")
});
let titlebar = if left_visible { let titlebar = if left_visible {
self.sidebar.read(cx).render_titlebar(cx) self.sidebar.read(cx).render_titlebar(cx)
} else { } else {
@@ -142,13 +144,48 @@ impl Render for AppRoot {
.text_color(theme.colors.foreground) .text_color(theme.colors.foreground)
.child( .child(
Shell::new("signed-shell", self.layout.clone()) Shell::new("signed-shell", self.layout.clone())
.toggle_button(false)
.left_sidebar(self.sidebar.read(cx).build(cx)) .left_sidebar(self.sidebar.read(cx).build(cx))
.right_sidebar(DockSidebar::new("signed-dock-sidebar", self.dock.clone())) .right_sidebar(DockSidebar::new("signed-dock-sidebar", self.dock.clone()))
.center( .center(
Dock::new("signed-dock", self.dock.clone()) Dock::new("signed-dock", self.dock.clone())
.window_controls(true) .window_controls(true)
.traffic_light_pad(!left_visible) .traffic_light_pad(!left_visible)
.sidebar_toggles(self.layout.clone()), .tab_prefix({
let layout = self.layout.clone();
move || {
let layout = layout.clone();
Button::new("toggle-left-sidebar")
.icon(IconRole::PanelLeft)
.variant(ButtonVariant::Ghost)
.small()
.on_click(move |_, _, cx| {
layout.update(cx, |layout, cx| {
layout.toggle_left_sidebar(cx)
});
})
.into_any_element()
}
})
.tab_suffix({
let layout = self.layout.clone();
move || {
if !repo_active {
return div().into_any_element();
}
let layout = layout.clone();
Button::new("toggle-right-sidebar")
.icon(IconRole::PanelRight)
.variant(ButtonVariant::Ghost)
.small()
.on_click(move |_, _, cx| {
layout.update(cx, |layout, cx| {
layout.toggle_right_sidebar(cx)
});
})
.into_any_element()
}
}),
), ),
) )
.when_some(titlebar, |root, titlebar| { .when_some(titlebar, |root, titlebar| {