Right now customizing keys is a bit tricky when using Wayland:
https://unix.stackexchange.com/questions/292868/how-to-customise-keyboard-mappings-with-wayland
But if you just want to remap a key so that it should function as another key, the command setkeycodes
seems to work.
Run sleep 1; showkey -s
in the terminal as root, and then press the key Up once, and then wait 10 seconds
root@laptop:~# sleep 1; showkey -s
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
^[[A0xe0 0x48
0xe0 0xc8
root@laptop:~#
From the output we see that 0xe0 0x48
is the scan code for the key Up.
Run sleep 1; showkey -k
in the terminal as root, and then press the key Right shift once, and then wait 10 seconds
root@laptop:~# sleep 1; showkey -k
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]
press any key (program terminates 10s after last keypress)...
keycode 54 press
keycode 54 release
root@laptop:~#
From the output we see that 54 is the key code for the key Right shift.
To remap the Up key to the Right shift key, run setkeycodes 0xe048 54
in the terminal as root.
root@laptop:~# setkeycodes 0xe048 54
The scan code was previously printed as 0xe0 0x48
, but now when it was given as an input argument to setkeycodes
, it was written 0xe048
.