How to remap keycodes in Xorg

24年 9月 24日 Tuesday
103 words
1 minutes

Background

When I tried to zoom in and out of my st terminal using the internal keyboard, it didn't work. I'm certain that I was pressing the correct key combination (Ctrl+Shift+Page Up/Down), but it didn't trigger any response. I use xev to debug the issue and turns out the Page up/down in the numpad area was different compared to the keycodes from external keyboard, so how to resolve this issue?

Using xmodmap

text
xmodmap -e "keycode 81 = Prior"
xmodmap -e "keycode 89 = Next"
xmodmap -e "keycode 79 = Home"

make the changes persistent across xorg session:

text
xmodmap -pke > ~/.Xmodmap

and edit your .xinitrc file to append:

text
xmodmap .Xmodmap

Title:How to remap keycodes in Xorg

Author:ReYuki

Link:https://www.reyuki.site/posts/remap-keycodes-in-xorg [copy]

Last updated:


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. You are free to share and adapt it, as long as you give appropriate credit, don’t use it for commercial purposes, and distribute your contributions under the same license. Provided under license CC BY-NC-SA 4.0