Skip to content

Instantly share code, notes, and snippets.

@hruan
Created August 5, 2022 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hruan/b0540121f227727b882dcac95e8696f5 to your computer and use it in GitHub Desktop.
Save hruan/b0540121f227727b882dcac95e8696f5 to your computer and use it in GitHub Desktop.
Fix Microsoft Sculpt key mappings for macOS

On the Nordic version of Microsoft Sculpt keyboard gets § and < keys are swapped for unknown reasons. To correct this, save file below as $HOME/Library/LaunchAgents/local.hidutilKeyMapping.plist and run

launchctl load $HOME/Library/LaunchAgents/local.hidutilKeyMapping.plist
launchctl start local.hidutilKeyMapping

For details see:

<?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>local.hidutilKeyMapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--matching</string>
<string>{
"VendorID": 0x45e,
"ProductID": 0x7a5
}</string>
<string>--set</string>
<string>{
"UserKeyMapping": [
{
"HIDKeyboardModifierMappingSrc":0x700000035,
"HIDKeyboardModifierMappingDst":0x700000064
},
{
"HIDKeyboardModifierMappingSrc":0x700000064,
"HIDKeyboardModifierMappingDst":0x700000035
}
]
}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment