# linux: Fix keyboard events not working on first start in X11 \(\#36224\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 23d04331584edc7656a480715cab9532ccfc5861

Requested commit: 23d04331584edc7656a480715cab9532ccfc5861

Commit: 23d04331584edc7656a480715cab9532ccfc5861

Tree: 6f0719028a60cb6bb4a321fbe45fd219a30e27d1

Author: smit

Committer: GitHub

## Message

```
linux: Fix keyboard events not working on first start in X11 (#36224)

Closes #29083

On X11, `ibus-x11` crashes on some distros after Zed interacts with it.
This is not unique to Zed, `xim-rs` shows the same behavior, and there
are similar upstream `ibus` reports with apps like Blender:

- https://github.com/ibus/ibus/issues/2697

I opened an upstream issue to track this:

- https://github.com/ibus/ibus/issues/2789

When this crash happens, we don’t get a disconnect event, so Zed keeps
sending events to the IM server and waits for a response. It works on
subsequent starts because IM server doesn't exist now and we default to
non-XIM path.

This PR detects the crash via X11 events and falls back to the non-XIM
path so typing keeps working. We still need to investigate whether the
root cause is in `xim-rs` or `ibus-x11`.

Release Notes:

- Fixed an issue on X11 where keyboard input sometimes didn’t work on
first start.
```

## Parents

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

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