# Fix a panic on Linux theme appearance change \(\#26019\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7ba2b258dea38a1960d970fed351cbeda6aed075

Requested commit: 7ba2b258dea38a1960d970fed351cbeda6aed075

Commit: 7ba2b258dea38a1960d970fed351cbeda6aed075

Tree: 9598d5091ffd543fcc2262493f2bd19cadbb516a

Author: Kirill Bulatov

Committer: GitHub

## Message

```
Fix a panic on Linux theme appearance change (#26019)

Closes https://github.com/zed-industries/zed/issues/26009


https://github.com/zed-industries/zed/blob/21484a2e9d07b6285f112ba49ca413cdb8e360e4/crates/gpui/src/platform/linux/platform.rs#L517-L519

`with_common` panicked at `borrow_mut` which is the way it's implemented
for X11, Wayland and Headless Linux counterparts.


https://github.com/zed-industries/zed/blob/21484a2e9d07b6285f112ba49ca413cdb8e360e4/crates/gpui/src/platform/linux/wayland/client.rs#L722-L724

By accessing the appearance global instead of a `RefCell` with it, the
panic goes away with one notable side-effect, on Linux only: the first
global's value on `Dark` appearance would be `Light`: it becomes normal
instantly, thanks to


https://github.com/zed-industries/zed/blob/21484a2e9d07b6285f112ba49ca413cdb8e360e4/crates/workspace/src/workspace.rs#L1083-L1090

Things work without flickering:


[linux_theme_toggle.webm](https://github.com/user-attachments/assets/0e39ddc0-b4ff-4475-93ff-7b2bd7233628)


Release Notes:

- Fixed a panic on Linux theme appearance change
```

## Parents

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

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