Creating physical escape key on new MacBook Pro with TouchBar by altering .keylayout for § key
- Install Karabiner-Elements
- Run it form the Launchpad (obviously)
- In "Simple Modifications" tab create a mapping "non-us-backlash" to "escape"
- Enjoy!
BTW key code for "§" is 0A (as reported by Karabiner Event Viewer)
I found some documentation on Remapping Keys in macOS 10.12 Sierra that works without any third party tools.
To change the key just above tab, set src to 0x64 (Keyboard Non-US \ and |) and dst to 0x29 (Escape). These values should be OR'd with 0x700000000 in the call to hidutil for some reason.
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}]}'
You could put this in a LaunchAgent (~/Library/LaunchAgents/give.me.esc.key.plist) to have it set every time you log in.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>give.me.esc.key</string>
<key>ProgramArguments</key>
<array>
<string>hidutil</string>
<string>property</string>
<string>--set</string>
<string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000029}]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Open System Preferences - select keyboard. Then select Modifier Keys... towards the bottom right of the window.
I have escape assigned to the caps lock key.
I agree using the control keys for escape is poor, but the caps lock key works very well. In practice, I've not really had any issue learning to use the soft escape key. Having caps lock is far faster once I got used to it due to decreased travel distance from the home row.
If you're using macOS 11, things have changed: Big Sur has breaking changes for "Karabiner", as macOS 11 "will no longer load kernel extensions that use deprecated Kernel programming interfaces (KPIs) by default" (As stated on Karabiner's website, developers are working to migrate to a newer mechanism, DriverKit, from kernel extension and they plan to support it at Karabiner-Elements 13.0.0).
If you're here to remap escape
, perhaps to section
you could use: Remap Keyboard. Version: 1.6 is: "Try for free and remap any one key."
Although, my hope is in future is Apple extends remapping the keyboard beyond just the modifier keys.