# Reapply traffic light position after appearance changes \(\#59712\) · gitcafe/zed

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

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

Visibility: public

Requested revision: f18e91efc6de8ae74fa7e7606203210a7a25286f

Requested commit: f18e91efc6de8ae74fa7e7606203210a7a25286f

Commit: f18e91efc6de8ae74fa7e7606203210a7a25286f

Tree: 39b13dd4846fef19c92dc5b5edf671f9e6751d29

Author: Vitaly Kravchenko

Committer: GitHub

## Message

```
Reapply traffic light position after appearance changes (#59712)

## Bug

Before switching macOS appearance:
<img width="154" height="39" alt="before switching OS theme"
src="https://github.com/user-attachments/assets/2444fafe-21a7-47f6-84ac-ec33a61a6523"
/>

After switching macOS appearance:
<img width="167" height="36" alt="after switching OS theme"
src="https://github.com/user-attachments/assets/d4a34555-2964-4e92-8d6a-24da7620fc49"
/>

After focusing the window following the macOS appearance switch:
<img width="151" height="37" alt="after focusing the window after
switching the OS theme"
src="https://github.com/user-attachments/assets/6bc2e996-256d-448d-a11b-fdc2f0e01f58"
/>

## Fix

Reapply GPUI's custom macOS traffic-light button position after AppKit
reports an effective appearance change and after GPUI's appearance
observers have been notified.

## Cause

GPUI stores a custom `traffic_light_position` for windows that use
transparent/custom titlebars. When macOS switches Light/Dark appearance,
AppKit can relayout the standard window buttons, which resets the
traffic lights to AppKit's default vertical position. The next normal
window focus/layout pass moves them back, causing a visible jump.

This change keeps the existing appearance observer callback behavior,
then re-runs `move_traffic_light()` after the callback has completed.

## Validation

- `cargo check -p gpui_macos --release --features runtime_shaders`
- Manually verified with a GPUI window using a transparent titlebar,
custom `traffic_light_position`, and an appearance observer that
refreshes the window.
- Toggled macOS Light/Dark appearance while the window was visible;
traffic lights no longer shifted upward.

Release Notes:

- N/A
```

## Parents

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

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