advertisement

How To Remap The Keys On Your Computer’s Keyboard In Linux And Windows

advertisement

Here is one of those things you probably did not know about me. I touch type. Okay. Even though I spend hours on my computer I rarely ever look at the keyboard. All I have to do is to reach for the F and J keys and I am good to go.

advertisement

My fingers will fly to the other keys automatically. At least they did until they met the new Lenovo laptop I am currently using. Okay it’s not really new but I am new to it. For some reason the idiots at Lenovo decided to swap the Right Shift Key and the Up Arrow (see picture).

Anybody who touch types will tell you that is a terrible mistake and I am sure they had some sort of manufacturing reason for doing this but that’s just criminal in my book. For the past week I have been bellowing in rage as every time I want to hit the Shift R key I inadvertently moved the cursor up. I don’t want to lie,this Lenovo laptop is lucky it still exists because many times I was tempted to hurl it across the room.

advertisement

Then a miracle happened: one of my colleagues suggested that I remap the keys. That sounded interesting so I asked for more information from him and it turns out I don’t know everything there is to know about computers as I initially thought.

How to do it in Linux

Okay I am not a Linux fan as some people seem to think. I live on Linux. I actually use Linux in my everyday life so naturally I will tell you how you can remap keys on Linux as I have already done and tested the process. I will also show you how you can do it on Windows but since I don’t have Windows on my new machine I cannot guarantee it will work.

To remap keys on Linux you will need the utility xmodmap to be installed. More often than not it is already installed as part of the xserver environment. Generally the following steps are involved when remapping keys in my case. All commands are run in a terminal $ (i.e. no need for sudo/root here):

  1. xmodmap -e “keycode 62 = Up”    This command makes the key with code 62 the UP key
  2. xmodmap -e “keycode 111 = Shift_R” This command makes the key with code 111 the Shift Right key
  3. xmodmap -e “add shift = Shift_R” Give shift powers to the new shift key
  4. xmodmap -e “remove shift = Up” Remove shift powers from old shift key
  5. xset r 62 This command makes sure the Up key is repeated.
  6. xset -r 111 Make sure the new Shift key is not repeated

The last two commands deal with repeating and you will notice they are a little different from the first four. The Up key needs the repeat function for example if you keep it pressed down it will continue to send the Up signal function as you say scroll up or are moving a game character. Shift does not need this behavior hence the two commands.

Basically all you need to do to swap key functions is to assign the function you want to swap to a new keycode say 62, add the function function of key 62 to the other key you want to swap e.g 111. Remove the old functions from the keys. If there is need to modify repeat behavior as in my case above do this. If you are wondering how to find keycodes and functions for various keys run the following command:

  • xmodmap -pk
  • Or xmodmap -pk>mykeymaps.txt

The last command will save current keycode mappings to the file mykeymaps.txt

and Windows

Visit the following Google Drive and download the two .reg files. They are clearly named so if you want to switch functions just click on the one labelled as “apply switch right arrow.reg”. If you will be asked to confirm that you want to edit your registry. The other .reg modification will remove this modification.


Quick NetOne, Telecel, Africom, Econet Airtime Recharge


WhatsApp Discussions

Click to join a Techzim WhatsApp group:
https://chat.whatsapp.com/EnkR09pi9CIGPYKvdXrLIp

If you find the group full, please notify us on +263 715 071 199 and we'll update the link.