My tribe like to switch their control and caps lock keys. I know how to do this† from the GUI. I'd like to go one step further, and put this step in my nascent dotfiles/osx file. Does anyone know how to do this from the command line, say using the defaults
command?
† If you have more than one keyboard (e.g. you use an external keyboard with your notebook), you must remap each keyboard, while they are attached, using the dropdown on the preferences dialog.
~/Library/Preferences/ByHost/.GlobalPreferences.*.plist
(where*
is actually a UUID which I expect identifies the host). Inside this file, an array namedcom.apple.keyboard.modifiermapping.*
is modified, where this*
identifies the keyboard. How to alter this in a predictable way from the command line, I don't know. But at least, it is a starting point. – Harald Hanche-Olsen Aug 28 '12 at 16:16