Merge pull request #162 from l0ng-ai/fix/windows-titlebar-chrome

fix(windows): titlebar chrome — ⋯ menu rhythm + clickable sidebar controls
This commit is contained in:
l0ng-ai
2026-07-25 10:34:56 +08:00
committed by GitHub
2 changed files with 42 additions and 24 deletions
+34 -21
View File
@@ -755,36 +755,49 @@ impl Tty7App {
.gap(px(2.))
// Glyph, not hit box, on the content edge — see `TILE_PAD`.
.pr(px(crate::ui::app::CONTENT_INSET - crate::ui::app::TILE_PAD))
// Both tiles are wrapped in an `occlude()` div, exactly like the
// title-strip chrome. This row is a `WindowControlArea::Drag` (set
// below), which on Windows maps to HTCAPTION — the OS claims the click
// as a window-drag before gpui ever hit-tests, so a bare button never
// fires its `on_click`. `occlude()` gives each a BlockMouse hitbox so
// hit-testing stops on the button. (No-op on macOS, where titlebar
// dragging doesn't gate child hit-testing — which is why this worked
// there and silently did nothing on Windows.)
.child(
self.attach_new_tab_menu(
// `chrome_tile`, not `ghost()`: this "+" sits beside the
// collapse tile and the title bar's own "+", and ghost's
// hover is a heavier, differently-derived grey.
div().occlude().flex_shrink_0().child(
self.attach_new_tab_menu(
// `chrome_tile`, not `ghost()`: this "+" sits beside the
// collapse tile and the title bar's own "+", and ghost's
// hover is a heavier, differently-derived grey.
crate::ui::tab_strip::chrome_tile(
Button::new("sidebar-add")
.icon(Icon::new(IconName::Plus).size(px(18.))),
false,
cx,
)
.xsmall()
.w(px(32.))
.h(px(32.))
.rounded_lg(),
cx,
),
),
)
.child(
div().occlude().flex_shrink_0().child(
crate::ui::tab_strip::chrome_tile(
Button::new("sidebar-add").icon(Icon::new(IconName::Plus).size(px(18.))),
Button::new("sidebar-collapse")
.icon(Icon::empty().path("icons/panel-left.svg").size(px(18.))),
false,
cx,
)
.xsmall()
.w(px(32.))
.h(px(32.))
.rounded_lg(),
cx,
.rounded_lg()
.tooltip("Hide Sidebar")
.on_click(cx.listener(|this, _, _window, cx| this.toggle_left_panel(cx))),
),
)
.child(
crate::ui::tab_strip::chrome_tile(
Button::new("sidebar-collapse")
.icon(Icon::empty().path("icons/panel-left.svg").size(px(18.))),
false,
cx,
)
.xsmall()
.w(px(32.))
.h(px(32.))
.rounded_lg()
.tooltip("Hide Sidebar")
.on_click(cx.listener(|this, _, _window, cx| this.toggle_left_panel(cx))),
);
// Borderless "Search tabs…" that sits directly on the sunk surface: a
// leading magnifier + an appearance-less input, no box and no divider
+8 -3
View File
@@ -215,9 +215,14 @@ impl Tty7App {
// *glyph* there instead of its 30px hit box.
.pr(px(crate::ui::app::CONTENT_INSET - crate::ui::app::TILE_PAD))
// On Windows/Linux the window controls (─ ▢ ✕) sit on the right, right
// where the "⋯" lands; give it extra breathing room there so it reads
// as a menu affordance, not a fourth window control.
.when(!cfg!(target_os = "macos"), |this| this.pr_3())
// where the "⋯" lands, so its inset has to match *their* rhythm rather
// than add breathing room: the 34px control tiles put consecutive glyph
// centres 34px apart, and the "⋯" centre sits `16 + pr + 17` from the
// minimise glyph. `pr_1` (4px) lands it at ~37px — reading as part of
// the same row, with just enough slack to not be mistaken for a fourth
// window control. `pr_3` (12px) put it at ~45px, visibly adrift from the
// group (this is where the de3896c chrome redesign reset it — see 9b1c7bf).
.when(!cfg!(target_os = "macos"), |this| this.pr_1())
.child(
div().occlude().flex_shrink_0().child(
chrome_tile(