sidebar: Fix window controls shifting when the sidebar is open (#64381)
## Objective
Fixes #63954
On Linux with client-side decorations, the window controls (close /
minimize / maximize) move 1px up and outward when the agent sidebar is
opened, and move back when it is closed.
## Solution
The title bar draws a 1px border in its own color to cover the window
border at the rounded corners, so the controls it renders sit 1px in
from the edge. When the sidebar is open,
`Sidebar::render_sidebar_header` renders the same controls without that
inset.
Added the matching 1px padding to the sidebar header under
`Decorations::Client`: top always, bottom only when no project is open
(otherwise the header's bottom border already accounts for it), and
left/right only on the side that renders the controls.
## Testing
Compared the close button position with the sidebar closed and open, on
stable 1.20.2 and on this branch, in a floating and a maximized window.
Before: moves by (-1, -1) px. After: stays on the same pixel in both
cases.
Tested on Fedora 44, GNOME on Wayland, with window buttons on the left.
Not tested with buttons on the right.
Validated with:
* `cargo build`
* `cargo test -p sidebar`
* `./script/clippy -p sidebar`
* `cargo fmt -p sidebar`
Before:
<img width="960" height="176" alt="before"
src="https://github.com/user-attachments/assets/c2b7dede-4c4c-4466-ba34-7666144e9cc1"
/>
After:
<img width="960" height="176" alt="after"
src="https://github.com/user-attachments/assets/d54172ca-be8e-4bb6-b5b3-ab193ac96423"
/>
## Self-Review Checklist
* [x] I've reviewed my own diff for quality, security, and reliability
* [x] Unsafe blocks (if any) have justifying comments
* [x] The content adheres to Zed's UI standards
* [ ] Tests cover the new/changed behavior
* [x] Performance impact has been considered and is acceptable
---
Release Notes:
- Fixed window controls shifting by 1px when the agent sidebar is open
on Linux.
---------
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
6fae7f3513PIYUSH RATHORE committed on 9/24/2026, 2:20:14 PM· committed by GitHubparent6990d3f