remap §/± to `/~ on max osx - 06-05-22
Got a new Macbook Pro with the start of my new job and I love it. Except. It did not come with and english keyboard. Now every time I try to type the backslash (`) or tilde (~) instead I get “§” or “±” 😔. Lucky for me there are a bunch of people with the same issue.
This base command to remap the key is:
$ hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x700000064,
"HIDKeyboardModifierMappingDst":0x700000035}]
}'
but to make this survive a computer restart things get a little more complicated. For that you need you need a LaunchDaemon.
/Library/LaunchDaemons/org.custom.backslash-key-remap-fix.plist
<?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>org.custom.backslash-key-remap-fix</string>
<key>ProgramArguments</key>
<array>
<string>/Users/travis.shears/projects/scripts/bin/backslash-key-remap-fix.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>
/Users/travis.shears/projects/scripts/bin/backslash-key-remap-fix.sh
#/bin/sh -e
hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x700000064,
"HIDKeyboardModifierMappingDst":0x700000035}]
}'
sources:
\- [
osx
]