In aquamacs, how can I remap the capslock key to meta? I can remap command to control using:
(setq mac-command-modifier 'ctrl)
Is there a similar way to remap the capslock?
EDIT: I know that I can remap keys in the system preferences, but I'd really like to confine the damage to aquamacs only. Just like mapping the command key to ctrl, but for capslock.
Best Answer
Aside from the "Modifier Keys" System Preferences section, I don't think an application can override the behaviour of the caps lock key..
I'm fairly sure the Caps Lock key event is not passed to applications, nor can they override the toggle effect.. Maybe you could do something whereby you monitor caps lock key state, and send alt when it changes.. but this is extremely convoluted, and slightly useless (it wouldn't work if you hold the key..)
Do you really need the caps lock key in other applications?
If so, perhaps you could write an AppleScript to toggle the Caps Lock key mapping? For example, in pseudo-code:
Shouldn't be difficult using AppleScript, the code from this Apple support thread should be a good start: