I will try to describe the problem in details. Very often I use external keyboard with my netbook. The keyboard is "TK Stealth":
You can see, that the numpad, is very similar to the classic numpad, but the arrow keys are actually mapped differently - as the additional arrow keys on a wide keyboards.
I want to make them to be mapped as in a numpad, i.e. "8" == "Up", "2" == "Down", "4" == "Left", "6" == "Right" and so on.
These settings must work only if this type of keyboard is attached.
I tried to make this using xmodmap /home/johnfound/TKStelth
with the following map file "TKStelth":
keycode 79 = KP_Home KP_Home KP_Home KP_Home
keycode 80 = KP_Up KP_Up KP_Up KP_Up
keycode 81 = KP_Prior KP_Prior KP_Prior KP_Prior
keycode 83 = KP_Left KP_Left KP_Left KP_Left
keycode 84 = KP_Begin KP_Begin KP_Begin KP_Begin
keycode 85 = KP_Right KP_Right KP_Right KP_Right
keycode 87 = KP_End KP_End KP_End KP_End
keycode 88 = KP_Down KP_Down KP_Down KP_Down
keycode 89 = KP_Next KP_Next KP_Next KP_Next
keycode 90 = KP_Insert KP_Insert KP_Insert KP_Insert
keycode 91 = KP_Delete KP_Delete KP_Delete KP_Delete
It works actually, but there are ugly side effects. For example, sometimes the layout is restored to the default and I must run the above script manually. Including the script to the initialization scripts caused some conflicts/locks that made the OS to hang for several minutes after resuming from suspend and changing screen resolutions. This way, I was forced to remove the scripts from the initialization scripts.
I read somewhere that xmodmap is actually the old way to handle keyboard layouts.
So, the question: How to configure Linux to handle this and only this keyboard properly?
Additional information: Manjaro Linux with XFCE. The keyboard is configured with two layouts - US and Bulgarian and they must stay after the above configuration changes.
KP_8
with NumLock on is the key withKP_Up
with NumLock off on both keyboards).