Created
August 28, 2021 18:22
-
-
Save josephdougs/20a2025f0fe469eadfcd5ad9454d8d53 to your computer and use it in GitHub Desktop.
Remap the right command key to escape in macbooks on MacOS Sierra or higher
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
#!/bin/bash | |
# hidutil can remap keys from one to another; | |
# This will wipe out any previous remappings you have from hidutil. | |
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000E7,"HIDKeyboardModifierMappingDst":0x700000029}]}' | |
# to remove this mapping, reset the user key mappings to be emtpy like this | |
# hidutil property --set '{"UserKeyMapping":[]}' | |
# to find other keys to remap, check this reference https://usb.org/sites/default/files/hut1_22.pdf | |
# Keyboard Usage IDs start at 82. | |
# Replace 0x7000000E7 with whatever code you want as the source key (with the format 0x7000000XX; where XX is the code), | |
# and 0x700000029 with whatever code you want as the destination key. | |
# It seems like not all of the Mac keys follow the standard, but they may be in the "reserved section". | |
# You will have to run this whenever you start up the computer, but you can find ways to run it automatically at startup as well: | |
# see this repo for how to do that: https://github.com/dchakarov/restore-tilde |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment