Mac M1/M2: Keyboard Brightness Keys + Remap § to ~

I recently moved from the US layout to the UK layout for my shiny new MacBook Air M2. I’d get used to the keys, however, my work MacBook is still on the US layout. Therefore, I decided to:

  1. Remap the section key § to tilde/back-tick (I use the tilde and back tick keys a lot)
  2. Remap the original tilde key to the left shift, so that I don’t accidentally hit the tilde in the wrong place
  3. Bring back the keyboard brightness keys by remapping the Siri (F5) + DND keys (F6)
<?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>com.judepereira.keyremapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>–set</string>
<string>{"UserKeyMapping":[
{
"HIDKeyboardModifierMappingSrc": 0xC000000CF,
"HIDKeyboardModifierMappingDst": 0xFF00000009
},
{
"HIDKeyboardModifierMappingSrc": 0x10000009B,
"HIDKeyboardModifierMappingDst": 0xFF00000008
},
{
"HIDKeyboardModifierMappingSrc": 0x700000064,
"HIDKeyboardModifierMappingDst": 0x700000035
},
{
"HIDKeyboardModifierMappingSrc": 0x700000035,
"HIDKeyboardModifierMappingDst": 0x7000000E1
}
]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

Save the contents above to ~/Library/LaunchAgents/com.judepereira.keyremapping.plist, and logout/login :)

That’s all!

Credits