# sidebar: Fix window controls shifting when the sidebar is open \(\#64381\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/6fae7f351370811131fe0f614a14125f84819415)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 6fae7f351370811131fe0f614a14125f84819415

Requested commit: 6fae7f351370811131fe0f614a14125f84819415

Commit: 6fae7f351370811131fe0f614a14125f84819415

Tree: c3d6a17240289cd6ac7a46f8541b144e24fbb988

Author: PIYUSH RATHORE

Committer: GitHub

## Message

```
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>
```

## Parents

- [6990d3f6787c3f20d7844fb81945e4aaa4689f32](https://git.cafe/gitcafe/zed/commit/6990d3f6787c3f20d7844fb81945e4aaa4689f32?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/6fae7f351370811131fe0f614a14125f84819415?format=markdown)
