Lenovo W530 and the Context Menu Key


The context menu key looks like this:

It’s normally on the same row as the space bar, usually to the right of it:

MenuKey1

This is how a Lenovo W530 (and Carbon X1, and probably many other current-generation models) keyboard looks:

Lenovo Keyboard

Notice anything missing?

Now, I could hit Shift+F10 any time I need the context menu (I’m sure you know that, right?) but I’m used to having the key there there.  And, besides, I don’t use PrtSc all that much.

Like all things interesting, the secret is in the registry.  Microsoft is kind enough to provide a guide, Scan Code Mapper for Windows.  It’s a little dated (a dozen years) but things like keyboard codes don’t really change all that much. 

Nor the difficulty in getting the registry entry just right.  It’s an unforgiving beast.

Enter SharpKeys.  It’s pretty straightforward to use: you map a key by telling the program that you’re going to hit the key you want to map, do that, then tell the program you’re going to hit the key you want the first key to send out as the keycode.  Here:

SharpKeys1

That’s me hitting the PrtSc key.  Now, to hit the … uh.  We are experiencing technical difficulties.  That’s actually the keycode for the context menu key.

Here’s a confession: this is why I’m writing this blog entry.  It’s cleverly caching the keycode for the context menu so I know where to go when I reformat my machine.  (Which I know I’ll do sometime in the next 6 months.)

Without further ado, here’s the keycode I want my PrtSc to send:

SharpKeys

Special: Application (E0_5D).

Now reboot.  Yep, you need to reboot for the magic to work.  Now you see why I need this post: doing this by trial and error will drive me mad.

Now, to be fair, Microsoft has it’s own tool: Microsoft Keyboard Layout Creator 1.4.  It’s only half a dozen years old.  Again, keyboard codes don’t change much.  I’ve just been using SharpKeys since around 2005-2006, hence my writing about it instead.  Back then it was the whole “the Control key belongs on TOP of the Shift key” fight.  Ah, happy days.

And, if you trust random regkey one-liners  you find out in the web, here’s something you can copy-and-paste into a .REG file and reg.exe import:

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,5d,e0,37,e0,00,00,00,00
Comments (11)

  1. Bernhard says:

    Using my brand new

    * flickering (some energy management stuff shortly reduces the backlight brightness from time to time,

    * bluescreening (due to driver issues with the mobile modem)

    * better remove the 8GB RAM extension, because that easily crashes the video signal

    Lenovo T540p

    I stumbled upon this post searching for this solution. Thank you!

    Not only this annoying keyboard layout clearly shows that the wrong kind of people are making the decisions here.

  2. Ken says:

    Dear Tim,

    Your blog entry is AWESOME!!!!!!!!! this helps me a lot! thank you very very very much.

    may God always bless you and your family.

    Once again, thank you!

    Regards,

    Ken

  3. timdunn says:

    @Bernhard and @Ken,

    Quite welcome.  I figure if I had to spend time on it, given the scale of the industry these days, many others will have to as well, so if I can save one person some frustration, it's worth my own frustration!

    Thanks for the feedback, all!

  4. viviana says:

    Thanks! couldn't find what was the name for that menu key taht I've lost in my laptop!!! very useful!

  5. Charlotte says:

    Can I just say how MUCH I thank you for this???  The context menu key I use all dang day long.  Thank you for this!  Shift F10 is not as efficient as smacking that menu key when you're moving through more than 100 emails in a day.  Thank you, thank you, thank you.  T540p rescued finally.

  6. PAYAMiN says:

    There were some keyboard problem for me in Thinkpad x240 which I replaced it with my old Thinkpad T240 recently.

    first: by default F1~F12 keys worked as their related FN keys. for example F1 worked as Mute, F2 as Volume Down, etc. I dont know who in this planet is using Brightness +/- or Volume +/- or Projector keys more often than F keys!

    this issue solved by using Fn Lock functionality by pressing Fn+Esc for one time, it will swap out their responsibility! thanks god it does not need to do after every Windows reboot. but it caused second issue:

    second: End and Insert keys are in same key, but when we use Fn Lock default key changed to Insert rather than End! last time i used Insert key was about 20 years ago when i was using Commodore 64 so SharpKey app helped me to swap End and Insert with together.

    and third problem was Context Menu key which i called it before Right Click key 🙂 and because SharpKey named it Application key i didn't find it, so finally your blog post rescued my life… thank u dude!

  7. Ruth says:

    Awe, thanks a lot for the instructions. I was dying searching for the stupid context menu key… WHo the hell are the brainers behind this model man! Ewww…

  8. Jonas says:

    Oh thank you for this. Every time I mention the context menu key to someone selling me a laptop, they look at me like I've grown a third eye.

  9. Robert says:

    This is brilliant–but would you mind providing a pointer to documentation on how to write the regkey one-liner?  I'd like to re-map the calculator key (just north of the number pad on my W540) to PrtSc in addition to re-mapping the PrtSc key to the Context Menu key.  Thank you so much!

  10. timdunn says:

    There isn't an easy way to just generate the reg subkey value. I've instead used SharpKeys to perform the mapping, then export the regkey.   My mapping the Calculator key to PrtScn alone gives me this subkey value:

    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout]

    "Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,37,e0,21,e0,00,00,00,00

    SharpKeys shows E0_21 is mapped to E0_37.

    Mapping both the Calculator key to the PrtScn key, and the PrtScn key to the Context Menu key gives me this subkey value.

    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlKeyboard Layout]

    "Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,37,e0,21,e0,5d,e0,37,e0,

     00,00,00,00

    (Yes, there appears to be a Unix-style line continuation character in the string.)

    SharpKeys shows E0_37 is mapped to E0_5D

    Notice that there is only one subkey.  I'm sure the keystroke mappings are ANDed on top of one another to generate the subkey value.

    ===

    IMPORTANT: The SharpKeys web page on CodePlex.com warns

    "Things that SharpKeys will not do:

    Allow you to swap two keys with each other – e.g. you can’t have Q and Z swap places because the remapping code would get confused."

    It doesn't address 'chaining keys' like what we're doing above: Calc becomes PrtScn becomes Context Menu, so your mileage will definitely vary.  I made the reg edits, but I'm going to undo them and revert back to the simple PrtScn becomes Context Menu.

    TL;DR: Your mileage will most likely vary.  I extend no responsibility, obligation, or other legalese if this causes any issues up to, but not including the heat death of the universe.

  11. Oliver says:

    Thank you for this post! I have been searching very long for the name/code of the menu key as well and was very happy to finally found it here!