Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support X11 MappingNotify events generated by user xmodmap changes #27384

Open
LuisDuarte1 opened this issue Mar 24, 2025 · 1 comment
Open
Labels
keybinds Keyboard shortcuts, mapping, binding, keymaps, etc linux-x11 Linux X11

Comments

@LuisDuarte1
Copy link

LuisDuarte1 commented Mar 24, 2025

Summary

When using Xorg, Zed does not update keyboard mapping when Xorg updates the keyboard mapping (MappingNotifiy event will be sent).

Example .Xmodmap:

keycode 21 = 0x3C 0x3E

Steps to trigger the problem:

  1. Open Zed with normal keyboard mapping
  2. Apply a modmap using xmodmap .Xmodmap
  3. Zed will still use the old keyboard mapping
  4. Restarting Zed will make it so that it uses the new keyboard mapping

Actual Behavior:
Uses old keyboard mapping

Expected Behavior:
To use new keyboard mapping

My workflow sometimes requires changing between keyboards of which I have slightly different keyboard layouts customized by xmodmap.

xmodmap manual pages state that a MappingNotify event will be sent to applications so that they can change they mappings, so I'm assuming that Zed does not listen to this event :)

Will try to open a PR for this :)

Zed Version and System Specs

Zed: v0.178.5 (Zed)
OS: Linux X11 ubuntu 24.04
Memory: 31 GiB
Architecture: x86_64
GPU: Intel(R) Graphics (RPL-P) || Intel open-source Mesa driver || Mesa 24.2.8-1ubuntu1~24.04.1

@LuisDuarte1
Copy link
Author

LuisDuarte1 commented Mar 24, 2025

Adding some logs to handle_event (https://github.com/zed-industries/zed/blob/main/crates/gpui/src/platform/linux/x11/client.rs#L660) seems like MappingNotify is getting filtered somewhere down the stack, maybe xim? will try to pull out the debugger for this :)

Docs state that The X server reports MappingNotify events to all clients. There is no mechanism to express disinterest in this event. so I assume that something in the stack is filtering the event.

@notpeter notpeter changed the title Zed doesn't update keyboard mapping when xorg triggers a MappingNotify Support X11 MappingNotify events generated by user xmodmap changes Mar 25, 2025
@notpeter notpeter added keybinds Keyboard shortcuts, mapping, binding, keymaps, etc linux-x11 Linux X11 labels Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keybinds Keyboard shortcuts, mapping, binding, keymaps, etc linux-x11 Linux X11
Projects
None yet
Development

No branches or pull requests

2 participants