I want to map some programs to the ten numbers of the numpad, which should start when I press mod4Mask + a number.

I know that ordinary numbers are accessed with xK_1, xK_2,... but what about the numpad numbers?

And will it make a difference if numlock is activated?


According to Xmonad/Key codes,

You can also search in /usr/include/X11/keysymdef.h and lower-case the first character (XK* becomes xK*).

Usually (some keyboard configurations differ), the large editing keypad sends symbols such as XK_KP_0, etc., (the symbols with _KP_), and pressing NumLock makes the keys send the alternate symbol (such as XK_0) which is printed on the keyboard.

xterm, for instance, uses that mapping of XK_KP_xxx to determine what escape sequences to send (this is taken for granted in Why doesn't my keypad work? in the XTerm FAQ).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.