MacOS – Creating physical escape key on new MacBook Pro with TouchBar by altering .keylayout for § key

keybindingskeyboardmacbook promacostouch-bar

The UK keyboard layouts for the TouchBar MacBook Pro's have a pretty useless §/± key at the top left that would be a perfect to use as a physical escape key (see this image).

macOS has a keyboard mapping system (/Library/Keyboard Layouts/ – eg. see http://www.gingerbeardman.com/UK.keylayout/ and https://developer.apple.com/library/content/technotes/tn2056/_index.html ) that allows keys to be changed around.

It seems possible to me that putting a line into the relevant keyboard layout similar to:

<key code="<code for that key>" output="&#x1B;" />

should allow me to make that key an escape key. (If I can find/create the layout for all the other keys too!)

Googling I've not found anyone mentioning they've done this, which seems odd to me. Is there some reason this wouldn't work? Can the TouchBar keyboard be remapped with a .keylayout file without losing any functionality?

I've been holding off buying a new macbook pro because of fear of losing the physical escape key! I know you can remap ctrl/cmd/etc to be Escape using System Preferences, but that seems like a poor solution in comparison.

Best Answer

  1. Install Karabiner-Elements
  2. Run it form the Launchpad (obviously)
  3. In "Simple Modifications" tab create a mapping "non-us-backlash" to "escape"
  4. Enjoy!

BTW key code for "§" is 0A (as reported by Karabiner Event Viewer)