# gpui: Add modal dialog window kind \(\#40291\) · gitcafe/zed

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

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

Visibility: public

Requested revision: bd2b0de231e2f76c963a08f3f98f5932ad1b3f13

Requested commit: bd2b0de231e2f76c963a08f3f98f5932ad1b3f13

Commit: bd2b0de231e2f76c963a08f3f98f5932ad1b3f13

Tree: b6984dc45b443af4ccf84aef497b0bbf39a75aa1

Author: Alvaro Parker

Committer: GitHub

## Message

```
gpui: Add modal dialog window kind (#40291)

Closes #ISSUE

A [modal dialog](https://en.wikipedia.org/wiki/Modal_window) window is a
window that demands the user's immediate attention and blocks
interaction with other parts of the application until it's closed.

- On Windows this is done by disabling the parent window when the dialog
window is created and re-enabling the parent window when closed.
- On Wayland this is done using the
[`XdgDialog`](https://wayland.app/protocols/xdg-dialog-v1) protocol,
which hints to the compositor that the dialog should be modal. While
compositors like GNOME and KDE block parent interaction automatically,
the XDG specification does not guarantee this behavior, compositors may
deliver events to the parent window unfiltered. Since the specification
explicitly requires clients to implement event filtering logic
themselves, this PR implements client-side blocking in GPUI to ensure
consistent modal behavior across all Wayland compositors, including
those like Hyprland that don't block parent interaction.
- On X11 this is done by enabling the application window property
[`_NET_WM_STATE_MODAL`](https://specifications.freedesktop.org/wm/latest/ar01s05.html#id-1.6.8)
state.

I'm unable to implement this on MacOS as I lack the experience and the
hardware to test it. If anyone is interested on implementing this let me
know.

|Window|Linux (wayland)| Linux (x11) |MacOS|
|-|-|-|-|
|<video
src="https://github.com/user-attachments/assets/bfd0733a-445d-4b63-ac6b-ebe098a7dc74"></video>|<video
src="https://github.com/user-attachments/assets/024cd6ec-ff81-4250-a5be-5d207a023f8c"></video>|
N/A | <video
src="https://github.com/user-attachments/assets/656e60a5-26b2-4ee2-8368-1fbbe872453c"></video>|

TODO:

- [x] Block parent interaction client-side on X11

Release Notes:

- Added modal dialog window kind on GPUI

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
```

## Parents

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

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