Mac – How to disable context menu key from Windows Keyboard

keyboardmac

I bought a Logitech USB keyboard (model K120) to use with my MBP while it's on a stand.

I got some help swapping the mapping of the command and option keys to the Alt and Windows keys so the layout is more like a standard Mac keyboard.

The next problem is this key:
enter image description here

(The one under the shift key with the rectangle with 3 lines on it.)

Apparently this is a Windows Context menu key.

I'm an iOS/Mac OS developer, and I keep pressing that key by mistake. It puts some non-displayed character into my source files. It generates an error "invalid character in source file" that prevents my code from compiling. Since it's non-printing it is quite hard to find, and is a real pain.

I'd like to map it to NOTHING so it stops inserting invisible compile-breaking characters into my source files. Alternately, mapping it to the control key would be good, since the control key is in the same spot on the other side of the keyboard. (I'd then have 2 control keys on that side of the keyboard, but whatever.)

Best Answer

Provided you are not running macOS Sierra (which from a previous question, I know you are). Support for Sierra is promised to come.

Install Karabiner.

Run it and on Change Key tab search for "Application Key" (or navigate to "For PC Users" -> "Change PC Application Key (Menu Key)".

Select the mapping "Application Key to Control_L".


To disable completely you'd have to edit ~Library/Application Support/Karabiner/private.xml (examples). The key code (reference) is PC_APPLICATION, so the following line will add a menu entry:

<?xml version="1.0"?>
<root>
  <item>
    <name>Disable Windows context key</name>
    <identifier>private.disable_windows_context_key</identifier>
    <autogen>__KeyToKey__ KeyCode::PC_APPLICATION | ModifierFlag::NONE</autogen>
  </item>
</root>

(press "Reload XML" in Karabiner window to apply after editing the file)