Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On my Linux computer, my keyboard switches from English to Serbian when I hold the Caps Lock key. For example, to write č all I have to do is hold Caps Lock, and press the key where č is on the Serbian keyboard (in this case, they key is ; on the English keyboard). When I release Caps Lock, the keyboard "switches back" to English, so that if I press ; I get ; as desired. Super useful.

Please note that I know how to change the keyboard layout. I want to use Caps Lock as a modifier key to change the language only while being held down!

Is there a way to replicate this behavior on Windows 7 or Windows 8?

Remark: This is sometimes known as "third level" character switching (pressing shift would be second level, for example). I am also not that attached to Caps Lock; other keys will do.

share|improve this question

4 Answers 4

up vote 1 down vote accepted
+50

Most reliable AutoHotKey script from my testing was this:

*CapsLock::
SetKeyDelay -1   ; If the destination key is a mouse button, SetMouseDelay is used instead.
;send {Blind}{CapsLock DownTemp}
PostMessage, 0x50, 0x02, 1,, A ; 0x50 is WM_INPUTLANGCHANGEREQUEST. 0x02 is forward
return

*CapsLock up::
SetKeyDelay -1  ; See note below for why press-duration is not specified with either of these SetKeyDelays.
;send {Blind}{CapsLock Up}
PostMessage, 0x50, 0x04, 1,, A ; 0x50 is WM_INPUTLANGCHANGEREQUEST. 0x04 is backward
return

Note: you need to have 2 input languages already set up in the windows region/language control panel.

Stand alone executable version here.

To stop the script, right click on the H in your task bar and click pause/exit.

If you want to retain the functionality of caps lock (ie: pressing it will turn caps lock on AND change language, releasing it will revert to previous language but leave caps lock on) just remove the two ; characters at the start of the two send lines.

Watch how fast i type this: ;č;č;č;č;č;č;č;č

Pretty fast, huh?

share|improve this answer
    
So fast, Luke. So fast... Thank you, this is amazing! :) –  Syzygy Oct 10 '12 at 21:52
    
P.S. What happens if I have 3 languages? (goes between first two?) –  Syzygy Oct 10 '12 at 21:53
1  
Yes, I think so. The caps-down action goes "forward" or "down" 1 in the list of languages and the caps-up action goes "back" or "up" 1 (switching back to the original language). –  Luke Nov 20 '12 at 23:13

The two previous answers, by @Jared and @pleinolijf, can be used together to construct the final answer.

Using Jared's answer, you could assign each keyboard layout a hotkey.

Using pleinolijf's answer, you could write a AutoHotkey script that will send the hotkey to switch to Serbian when CapsLock is pressed down, and then the English one when it is released.

Without testing anything, this may be similar to :

Capslock::{Serbian-hotkey}
Capslock Up::{English-hotkey}
share|improve this answer

In windows 7, you can set multiple keyboard overlays by going:

Control Panel-> "Clock, Language, and region" -> "Change Keyboards or other input methods" -> "Keyboards and Languages" tab -> "Change Keyboards"

From here you can add the Serbian Keyboard under installed services.

By default, Alt+Shift is the default combination to switch between keyboards, but you can customize this under the Advanced Key Settings tab.

As far as I know there isn't a third level modifier option, but this method would allow you to swap key sets, type the necessary characters, then switch back again.

share|improve this answer
    
Ah, thanks, but this isn't what I need. –  Syzygy Oct 8 '12 at 22:37

You probably can do this fairly easily using AutoHotKey. You'll need to read yourself into it a bit if you haven't used it before, but it can be used to map anything to any key.

See this for remapping of keys (conveniently, there's an entry specifically for Caps Lock).

share|improve this answer
    
I'm not sure that it can be done. What signals do I force when I press Caps Lock? –  Syzygy Oct 8 '12 at 13:55
    
I reread your question, and I think I misunderstood you initially. If you want the CapsLock to do a different keyboard layout 'overlay' while pressing it, then that is indeed very difficult to achieve. No idea how you would do that, sorry. –  pleinolijf Oct 8 '12 at 14:00
    
Maybe one could cook up something with MSKLC ? –  pleinolijf Oct 8 '12 at 14:03
    
I'll try MSKLC at some point; I'll get back to you. Thanks. –  Syzygy Oct 8 '12 at 22:38
    
MSKLC can't handle the task. –  Syzygy Oct 10 '12 at 21:51

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.