Keyboard remapping to increase usability and productivity (for Windows users)

Changing or disabling the function of keys is something I bet many computer users have wanted to be able to do at some point. This blog post will show Windows users how it can easily be done with the use of a free software and will take a look at what this software actually does to make it happen.

I still remember the first time I’ve had an interaction with remaps. I would not call it a pleasant experience, but I think it is worth sharing.

‘Hacked’ by remapping

The story dates back to the early 2000s when I was pretty much a toddler making his first steps in the behind-the-keyboard world. As you can imagine, the main and probably only thing I was interested about regarding computers was, well… games.

Back then the only place I could find them was my internet provider’s public FTP (a FTP, which all people using my internet provider’s services were allowed to access and share files with each other). In the ‘Games’ folder there, I found a .zip file I still remember the name of — ‘Candy’ (not that I knew what this word meant in English at the time).

We all know how kids are taught not to take candy from strangers. We also know how they hardly ever regard such advice. Needless to say, a frivolous kid like me was easily lured into the trap of downloading it. The .zip consisted of a single file, which I, eager to start playing, instantly unzipped and executed. I got a strange success message, clicked OK but did not get to play any game. I was left a bit disappointed, but got over it quickly.

The worse part was when I started my computer on the following day and could not type my password because my keyboard was completely numb and not functioning at all. Of course, I thought it was a hardware problem and made my parents spend money on a new one, which did not solve the problem and only after I got my Windows re-installed, everything got back to normal.

It was years later when I was about fourteen that I learnt about binary key remaps and managed to connect the dots and make sense of what had happened. The file I had downloaded as a child, had been a simple .reg one that remapped all my keys, binding them to nothing, whose changes were applied upon system startup.

This was my first good lesson that the Internet is not that safe a place and you have to be careful, especially when executing files downloaded from unknown sources.

Why remap/kill keys?

Usually, the more time you spend doing something, the more annoying things you find about it and the more they annoy you. Having spent quite a lot of time behind a keyboard, I can undoubtedly say that for me this irritant has always been the ‘Caps Lock’ key. Its position makes it easy to mis-press and requires you to press it again in order to revert its function. Moreover, I hardly ever find myself in need of typing all-uppercase text and, even when I do, I am good with holding the ‘Shift’ key.

Recently I started using the Sublime Text vintage mode, which is a Sublime plugin to simulate the VIM text editor, and thought the ‘Caps Lock’ key will be a comfortable one to use for entering ‘Command mode’. I binded it to the function doing it, but had problems since, while alternating between modes, sometimes it was left in an ‘On’ state and when I started typing, the text would turn out to be all-uppercase. Pressing it again would make me enter ‘Command mode’ and I started getting into quite twisted situations because of the double-functionality of the ‘Caps Lock’ key.

In order to avoid such problems, I simply had to strip the key of its default functionality. That is when I had a flashback of when I was fourteen, remembered I actually know how to do that and thought it might be a good idea to pay it forward.

How to remap/kill keys?

SharpKeys

Тhere are numerous software products by means of which you can easily remap and/or kill keys. The one I would recommend is ‘SharpKeys’.

Download link: SharpKeys

Mainly, it looks something like this. You have two lists of keys. On the left you choose which key to remap and on the right — which key to map it to. The illustrated example on shows a configuration of how to kill the ‘Space’ key (not recommended). If you click OK, the remap operation will be added in the ‘SharpKeys’ list.

Then, all you have to do is click the ‘Write to Registry’ button and when you restart your computer, you will have no function behind the space key. Job done! If you want to add another remap action, simply click on ‘Add’. You can also delete and edit remaps from the buttons below the list. Just make sure you always click ‘Write to Registry’ after you make changes and remember that they are applied after you restart your computer.

The next part of this post will take a look at what the ‘Write to Registry’ button actually does and show you how things used to be done back in the previous century. You might not find it so useful, because of software products like the latter one, but I think it is worth being mentioned for the curious part of you.

Binary remapping

What is the Windows Registry? To avoid diving too deep into technical terms, you can think of the registry as a database that stores low-level settings used by the user interface, some applications, but mainly by the Windows operating systems. In other words, this is the place where the better part of Windows’ settings are stored.

The Windows Registry has a section by the name of ‘Keyboard Layout’, which we will use to alter the default function of whichever keyboard key. To access it, open the start menu and start the ‘Run’ app. Alternatively, you can use the ‘Windows key+R’ shortcut. Type ‘regedit’ in the textbox and click on ‘OK’.

Note: If you are not the administrator of the PC you are using, you might not be able to access it due to security purposes.

Once you have accessed the ‘Registry Editor’, navigate toHKEY_LOCAL_MACHINE/SYSTEM/ then choose CurrentControlSet/Control/ and select the ‘Keyboard Layout’ folder. Provided you have no remaps, the window should look something like this:

Note: If you have done remaps via the ‘SharpKeys’ software, they will be listed here. You can double click on them to see their binary code.

Now, you have to create a setting for your PC to take into consideration upon startup. To do so, right-click within the window, hover on ‘New’ and then choose ‘Binary Value’. You may name the newly appeared setting however you like. I suggest giving it a name that would later inform you on what the remap actually does, so you can easily locate it when you return later. Double-click on the new setting and a window titled ‘Edit Binary Value’ shall open. Now comes the tricky part where you will have to give some instructions to your computer. By typing binary! How cool is that!

Here is an image of the binary code used to kill the ‘Caps Lock’ key and we will go through it bit by bit (if you have done this via ‘SharpKeys’, the setting will be already in the list and will look exactly like the one below).

→ The first line consists of sixteen zeros, which you may ignore, since they do not have a significant meaning but should be there, so you must not skip them.

→ The ‘02’ in red represents how many remaps there will be plus 1. Since we are doing a single remap now, we set it to 2. If you were to do 4 remaps, you would use ‘05’.

→ Then you have 6 more zeros and we get to the part in blue . This is the scancode of the key we are mapping TO (find scancodes of all keys in the link below). Since we want to kill the ‘Caps Lock’, we are using ’00 00’, which is a scancode of a non-existent key. Therefore, it will disable (kill) the ‘Caps Lock’ key.

→ Right after that is the part in green . This is the scancode of the key we are mappingFROM. In this case, the ‘Caps Lock’ key. Its scancode is ‘3A 00’.

→ The next 8 zeros should always be what you are ending with, since they act as a null terminator, a sign for the computer that the command is over.

Find scancodes of most keys here: Microsoft

To perform multiple remaps (2 in the example), you can use the following binary as a template:

As you can see from the number in red , there are two remaps in this setting. The first blue ​ number is the ‘Down Arrow’ code and the first green ​ number is the ‘Left Arrow’ code. This means that the ‘Left Arrow’ key will be mapped to the function of the ‘Down Arrow’ one (not recommended, this remap is used just for the example). The second remap contains ‘0F 00’, which is the ‘Tab’ key and ‘3A 00’ — the well-known ‘Caps Lock’. In other words, the ‘Caps Lock’ will function as a ‘Tab’ key. The code ends with the 8 terminating zeros.

To delete a remap, you can right click on it in the list and choose the ‘Delete’ option as shown:

Things you cannot do with either way of remapping

→ Map one key to a combination of others. For example, map ‘Caps Lock’ to the Shift+4 combination in order to produce a dollar sign.

→ Swap two keys. For example, swap the ‘Left Ctrl’ and ‘Left Alt’.

→ Map mouse clicks.

→ Map keys for a particular user only. The Registry is only one for each machine. That said, modifications in the Registry editor will take place for all users on the computer.

Rarely used keys you might want to remap

Keys I hardly ever use and have remapped are — ‘Caps Lock’, ‘Right Alt’, ‘Right Ctrl, ‘Right Shift’, ‘Page Up’, ‘Page Down’, ‘Scroll Lock’, the Context Menu key and ‘Insert’.

Conclusion

I hope this post has shed some light on how to free yourself of the exasperating unused keys, find better purpose for them and understand how these things happen on a slightly lower level.