My question is referring to the System Preferences
setting that enables you to remap Caps Lock
to e.g. Ctrl
key.
^ Is it possible to affect this setting programmatically?
Primarily I'd be interested achieving this via defaults
or some shell trick; secondarily via AppleScript (yuck).
I know I can probably achieve this by using 3rd party tools, such as KeyRemap4MacBook, but that's a last resort. But I'd rather prefer a non-3rd party solution, if possible.
My use case:
Using Keyboard Maestro and its nice macro triggers, I'm looking to automatically remap Caps Lock -> Ctrl
in apps like MacVim, and toggle it back to normal Caps Lock when leaving the affected apps.