javalinuxintellij-ideanumerickeypad

How to get numeric keypad arrows working with java applications on Linux


The arrow keys on the numeric keypad do not work with Java applications on Linux. Strangely enough, the Home, End, PgUp, PgDn, Ins, Del all work.

This is especially annoying when using Intellij for programming.

How do you get the arrow keys working?


Solution

  • Physical keys on a keyboard are mapped to key codes using xkb. Here's how I got numeric keys working with java applications (like Intellij) on a Debian derivative of Linux:

    1. Switch to root user
    2. cd /usr/share/X11/xkb/symbols
    3. cp keypad keypad.original (just in case)
    4. Edit keypad and replace all occurrences of KP_Up, KP_Down, KP_Left & KP_Right with Up, Down, Left & Right, respectively
    5. Save
    6. dpkg-reconfigure xkb-data
    7. Reboot

    Now the numeric keypad will emit the regular, arrow, key codes and not the java-unrecognised, numeric keypad, arrow, key codes.