Using setxkbmap for a simple remap (similar to xmodmap)
You can follow the general idea seen in my answer on a similar problem; if you still want layout switching (although still quite broken) you should define a new layout or variant.
Notice that the template to copy and modify for the editing an keypad is a bit difficult to find. In my keyboard, for example, the geometry is "pc105"; this is defined in /usr/share/X11/xkb/symbols/pc
. If you look into it, it include:
[...]
key <SPCE> { [ space ] };
include "srvr_ctrl(fkey2vt)"
include "pc(editing)"
include "keypad(x11)"
key <BKSP> { [ BackSpace, BackSpace ] };
[...]
The keypad is defined in the file /usr/share/X11/xkb/symbols/keypad
[...]
default partial hidden keypad_keys
xkb_symbols "x11" {
include "keypad(operators)"
key <KP7> { [ KP_Home, KP_7 ] };
key <KP8> { [ KP_Up, KP_8 ] };
[...]
For the name of the key symbols (keysims), the best place to look is into the file /usr/include/X11/keysymdef.h
; you may need to have the development packages installed to have it (or install it by instaling x11proto-core-dev
):
[...]
/* Cursor control & motion */
#define XK_Home 0xff50
#define XK_Left 0xff51 /* Move left, left arrow */
#define XK_Up 0xff52 /* Move up, up arrow */
[...]
the keysym name is the one you have once removed the "XK_" string.