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.


Most reliable AutoHotKey script from my testing was this:

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

*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

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?

| improve this answer | |
  • So fast, Luke. So fast... Thank you, this is amazing! :) – MarkovCh1 Oct 10 '12 at 21:52
  • P.S. What happens if I have 3 languages? (goes between first two?) – MarkovCh1 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

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).

| improve this answer | |
  • I'm not sure that it can be done. What signals do I force when I press Caps Lock? – MarkovCh1 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. – MarkovCh1 Oct 8 '12 at 22:38
  • MSKLC can't handle the task. – MarkovCh1 Oct 10 '12 at 21:51

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.

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

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 Up::{English-hotkey}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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