Skip to content

Instantly share code, notes, and snippets.

@Axlefublr
Created August 8, 2024 09:28
Show Gist options
  • Save Axlefublr/e299af20a5a92a0959159b76c07d207d to your computer and use it in GitHub Desktop.
Save Axlefublr/e299af20a5a92a0959159b76c07d207d to your computer and use it in GitHub Desktop.

Remap keys on the xkb level

  1. xev will show you output like this:
KeyRelease event, serial 36, synthetic NO, window 0x3200001,
    root 0x530, subw 0x0, time 4335057, (943,136), root:(943,694),
    state 0x0, keycode 78 (keysym 0xff14, Scroll_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False
  1. sudo -E nvim /usr/share/X11/xkb and search for <I78> (this is the keycode)
  2. It is “mapped” to some amount of characters
  3. Change each character to whatever you want to remap to
  4. You can figure out the name of the character by once again doing xev, but now looking for the character name (would be Scroll_Lock in this case)
  5. I thought you need to reboot to make it update, but restarting xremap does the same thing, for whatever reason

xremap interprets the raw keycodes, not they keysyms they result into, so you can't use this method to remap something into being supported by xremap.

You can also run xremap like: RUST_LOG=debug xremap config-path.yml to make it yell out keys you're pressing, in case you just wanna check the name of the actual key you have.

If it doesn't yell out some key after you press it, it means it doesn't support that one :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment