Last active
June 23, 2025 21:35
-
-
Save apfelchips/da1eed8d74aabd8caee9ce2968de6ed9 to your computer and use it in GitHub Desktop.
macOS US layout fix tick location on ISO Keyboards + Capslock --> LCtrl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
if [ "$(id -u)" -ne 0 ]; then | |
echo "Script has to be run as root" | |
exit 1 | |
fi | |
KEYMAP=$(cat << EOF | tr -d ' ' | grep -v '^#' | tr -d '\n' | |
# https://apple.stackexchange.com/a/374074 | |
# https://developer.apple.com/library/archive/technotes/tn2450/_index.html | |
{"UserKeyMapping":[ | |
{ | |
# Caps Lock --> Left Control | |
"HIDKeyboardModifierMappingSrc":0x700000039, | |
"HIDKeyboardModifierMappingDst":0x7000000E0 | |
}, | |
{ | |
# Grave Accent and Tilde --> Non-US \ and | | |
"HIDKeyboardModifierMappingSrc":0x700000035, | |
"HIDKeyboardModifierMappingDst":0x700000064 | |
}, | |
{ | |
# Non-US \ and | --> Grave Accent and Tilde | |
"HIDKeyboardModifierMappingSrc":0x700000064, | |
"HIDKeyboardModifierMappingDst":0x700000035 | |
} | |
]} | |
EOF | |
) | |
set -x | |
hidutil property --set $KEYMAP >/dev/null | |
hidutil property --get "UserKeyMapping" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>Disabled</key> | |
<false/> | |
<key>EnvironmentVariables</key> | |
<dict> | |
<key>__Comment</key> | |
<key>__Install_Location</key> | |
<string>/Library/LaunchDaemons/ / owner: root group: wheel</string> | |
</dict> | |
<key>Label</key> | |
<string>me.user.keyremaps</string> | |
<key>Program</key> | |
<string>/Library/LaunchDaemons/keyremap.sh</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>StartInterval</key> | |
<integer>600</integer> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment