If you are using linux, you can use xev
to learn about the keys on your keyboard and xmodmap
to remap them.
Here's output of me running xev and pressing the letter "A". You'll want to take note of two things:
- the keycode (in the below example, the keycode for 'A' on my keyboard is 38:
- the name of the key (in the below example that would be what shows up as the last value inside the the parenthesis containing the keysym hex value and name (keysym hexadecimal_value, keyname) like (keysym 0x41, A)
$ xev
KeyRelease event, serial 32, synthetic NO, window 0x2600001,
root 0x192, subw 0x0, time 140212192, (223,614), root:(1184,615),
state 0x2, keycode 38 (keysym 0x41, A), same_screen YES,
XLookupString gives 1 bytes: (41) "A"
XFilterEvent returns: False
If you want to remap a key, you'd use xmodmap
. Below is how you would map a theorectical keycode of 1 to the A key shown above:
xmodmap -e "keycode 1 = A"```
Do xev and xmodmap detect the keys which aren't part of the keyboard map? In your example a basic remapping task is performed. I'll also appreciate if you add a method for Windows to your answer. – user1067707 – 2019-07-26T10:15:23.680
If the key is dead, you wont have anything show up in the response on the terminal prompt. Regarding windows, I found this info on autohotkey which seems pretty good: https://superuser.com/questions/348070/equivalent-for-xev-on-windows
– user138278 – 2019-07-26T16:28:28.200I mentioned AHK in my question, the macro keys aren't detected. – user1067707 – 2019-07-27T08:11:27.203