Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I just started out using tmux, so I figured I would set my Caps lock key equal to the Ctrl key.

Though sometimes I do need the Caps lock key. I don't care if it requires playing with the Terminal or system files, I'm not afraid of that. However it would be nice if I could just run Terminal commands so that I can put it in a script. Also, if possible, it would be nice if it doesn't require extra software, although if it's necessary then there's no problem.

How can I make it so that it's normally a Ctrl key, but if I press it for say 5 seconds it triggers a normal Caps lock. I was wondering, how can I do this?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Using KeyRemap4MacBook, you could add this to private.xml:

<autogen>--HoldingKeyToKey-- KeyCode::CONTROL_L, KeyCode::CONTROL_L, KeyCode::VK_NONE, KeyCode::CAPSLOCK, Option::NOREPEAT</autogen>

The threshold for holding a key is 0.2 s by default, but it can be changed in the second tab.

This would change fn+caps lock (control) to caps lock:

<autogen>--KeyToKey-- KeyCode::CONTROL_L, ModifierFlag::FN, KeyCode::CAPSLOCK</autogen>

share|improve this answer
    
That would work. However this old Mac keyboard doesn't have an fn key (it's kind of old). How could I change that to option+capslock? –  Greduan Dec 30 '12 at 14:58
    
Also, I suppose this requires KR3MB? Yes? If so, is there a way not to use KR4MB? –  Greduan Dec 30 '12 at 15:06
    
Just change ModifierFlag::FN to ModifierFlag::OPTION. I don't know any other way to do it. –  Lri Dec 31 '12 at 9:54
    
I see, thank you! That works out. –  Greduan Dec 31 '12 at 13:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.