Customize Key Mappings on Surface and Other Keyboards

Configure a right Ctrl key, remap Caps Lock, and more.

Advertisements

As someone who uses keyboard shortcuts often to stay productive, comfortable access to the Ctrl key is a must.

The Surface Type Cover only offers a left Ctrl key which I find just disruptive enough to be a nuisance during everyday use.

Fortunately, Windows provides a (albeit obscure) mechanism to remap key bindings.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,1d,e0,5d,e0,00,00,00,00

The Scancode Map key (described in detail here) enables you to configure custom key mappings such that pressing a key on the keyboard generates the scan code of another key.

Given my limited use of the Context Menu key and its natural proximity to a typical right Ctrl key, I find that remapping the Context Menu key to right Ctrl is perfect. Remapping Caps Lock as an additional left Ctrl key offers even more comfortable access and mitigates the age old problem of inadvertent Caps Lock activations. Note: If you will miss lack of the Context Menu key, know that Shift + F10 is an equivalent alternative in many places.

The above Scancode Map value will configure these changes for you. Save the entire block to a .reg file (including the registry editor version header shown in the snippet), then execute the file to import the value into the registry. Reboot for the changes to take effect. Note: If you ever want to undo this change, just navigate to the Keyboard Layout key in regedit and delete the Scancode Map entry.

This Scancode Map has been available in Windows for ages so can be used to configure similar mappings in all kinds of keyboards (even for keys the keyboard doesn’t have). I use the below Scancode Map on my Microsoft Wired Keyboard 200 (a keyboard that lacks volume keys) to map Caps Lock to left Ctrl, PrtScn to Mute, ScrlLk to Volume Down, Pause to Volume Up, and Num Lock to null.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,06,00,00,00,1d,00,3a,00,20,e0,37,e0,2e,e0,46,00,\
  30,e0,1d,e1,00,00,45,00,00,00,00,00

This remaps Caps Lock as described above while also adding volume control to 3 keys I never use anyway. Note: Num Lock to null was necessary to remap the Pause key correctly but also is a righteous change in itself since I never use the Num Pad for anything other than number entry.

For a list of available scan codes to insert into the Scancode Map, I’ve found that the list maintained in the SharpKeys source code is the most reliable. Feel free to try out SharpKeys as well if you prefer to modify the Scancode Map registry key with a graphical interface.

Note: Windows used to reset the Scancode Map after an OS upgrade which was incredibly annoying for someone in the Windows Insider program who installs OS updates frequently. Fortunately as of build 14951, that is no longer the case:

We’ve updated our migration logic to now include custom scan code mappings. That means that going forward from this build, if you’ve used Registry Editor to remap certain keys (for example, Caps Lock key to null), that change will persist across upgrades.

All the more incentive to configure the keyboard the way you like it.

9 thoughts on “Customize Key Mappings on Surface and Other Keyboards”

  1. Hi Mike,
    Can you tell me what the reg code would be to ONLY change the Context Menu key to a control key? I just got a Surface and the lack of right CTRL is a pain. Thanks!

    Like

  2. Thank you, thank you, thank you! The lack of a Right-Ctrl key on my Surface has been making me nuts for the 5 days I’ve had it. I just banished the Context key and replaced it with a Right-Ctrl.

    Like

  3. I’m sorry to ask a trivial question since my knowledge of hex and binary is a little rusty… or just lazy since I got my BS EE 25 years ago…
    How do I import the scancode map that’s in hex.
    regedt32.exe keeps complaining that the input file is not a binary file?

    Thanks,
    Alex

    Like

    1. Alex, I added editor version line at top of reg file and it then imported without the error I assume you are seeing. I imported, rebooted, but this did not remap my context menu key. Ugh. Using new Surface Pro 2017 and Surface Type Cover. Win 10 pro ver 1709, build 16299.64
      Not sure what this did in the registry for for keyboard. Glad I snapped a system restore point first. Will now roll back. But I think this approach is on the right track, just need to figure out the correct Scancode Map.

      Windows Registry Editor Version 5.00
      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
      “Scancode Map”=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,e0,5d,e0,00,00,00,00

      Cheers,
      Mark

      Like

  4. Hi! I’m a complete coding newb. I just want to change my menu key into a ctrl key as stated in this post but I can’t figure it out. Would a kind soul help me please? This is what I did so far, (I have the surface book 2, windows 10)
    Opened Notepad and pasted in “[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
    “Scancode Map”=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,1d,e0,5d,e0,00,00,00,00”
    then saved as a .reg file (and making sure to check the file format was all files)

    Then I double clicked it and it said “The specified file is not registry script. You can only import binary registry files from within the registry editor”

    Please help!!

    Like

    1. I believe you need to add the registry editor version header at the beginning of the .reg file (the same header that regedit adds when you export a key to a .reg file). Without the header, I get the same error as you.

      I’ve updated the snippets in this article with the header. Can you see if that works for you?

      Like

      1. Thanks for your super quick response Mike! I just tried this. My menu button is still a menu button but at least the editor imported my file now with the header you added! My friend recommended I use auto hot key since it worked for him that way.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s