I would like to switch the Right Command (⌘) Key order with the Alt Key under the System Preferences (to be just like Windows) but there appears to be no option under System Preferences.
Does anyone know how to move these keys' locations using Karabiner-Elements or some other software? In this case we would swap the right-hand Alt and Command keys.
(source: tekrevue.com)
Best Answer
Apple's Technical Note TN2450 describes how to remap keys. It is important to know that Right Command is also Right GUI. Running the following command will switch Right Command and Right Alt (if you also want to do the Left Command and Left Alt, refer to the technical note to get the hex values and the Python code below to do the
or
operation).The table at the bottom of the Technical Note has a list of hex values for each key. To generalize the above answer to switch any keys (at least is macOS Sierra), you must
or
the hex value from that list together with0x700000000
. The following Python code demonstrates one way to do this.