Skip to content

Instantly share code, notes, and snippets.

@raj-saxena
Last active June 13, 2021 16:07
Show Gist options
  • Save raj-saxena/c068fd3aed4efb2bdde415ab5a51159c to your computer and use it in GitHub Desktop.
Save raj-saxena/c068fd3aed4efb2bdde415ab5a51159c to your computer and use it in GitHub Desktop.
Change the weird key(§/±) on International keyboard to grave accent and tilde(`/~) and vice versa.

Change the weird key(§/±) on International keyboard to grave accent and tilde(`/~) and vice versa.

hidutil property --set '{
  "UserKeyMapping": [
    {
      "HIDKeyboardModifierMappingSrc": 0x700000064,
      "HIDKeyboardModifierMappingDst": 0x700000035
    },
    {
        "HIDKeyboardModifierMappingSrc": 0x700000035,
        "HIDKeyboardModifierMappingDst": 0x700000064
    }
  ]
}'

Reference - https://apple.stackexchange.com/questions/283252/how-do-i-remap-a-key-in-macos-sierra-e-g-right-alt-to-right-control

Add as a script and enable it to run on every login

 sudo defaults write com.apple.loginwindow LoginHook ~/workspace/scripts/change-mac-keymappings.sh

# remove with
sudo defaults delete com.apple.loginwindow LoginHook

Reference - https://superuser.com/questions/295924/how-to-run-a-script-at-login-logout-in-os-x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment