Home-made layout mapper for Windows

    A lot has been written about switching keyboard layouts, including on the hub When, a year or two ago, I realized that the usual Ctrl + Shift did not suit me, of course , I did not begin to reinvent the wheel, but started looking for what had already been invented on this subject. And temporarily drowned in an ocean of ideas and opinions.
    I had two reasons to look for the best. Firstly, wonderful people from the number of laptop manufacturers came up with the Ctrl keys to place Fn in the usual place (sometimes this can be fixed in the BIOS). With the normal arrangement of the keys, the combination of Ctrl + Shift is typed without looking, and after the improvements everything has become different everywhere. Secondly, additional layouts were needed . A cyclic switch for three or more layouts- this is a disaster, you can forget about automation.
    I tried a lot of options starting with Punto. Everyone was not happy with something. In the end, I built my own bike based on the AutoHotKey script , which I use. I publish as an exchange of experience, not claiming any novelty.
    The two main layouts are included deterministically, English - CapsLock, Russian - Shift + CapsLock. The remaining installed layouts are connected cyclically, given their rare use. I will not say anything about the pros and cons, the convenience of switching layouts is a very individual matter.

    [ Update. With the filing Crazybot started using RusLat. While it works like a clock, and does everything that is needed, and nothing more (!). Configured CapsLock - English, Shift + CapsLock - Russian, Ctrl + Shift - cyclic switching of other layouts. If the sources were published, it would be amazing in general.]
    [ Update. Returned to the "bike" with reassigned CapsLock. Otherwise, sometimes CapsLock still manages to turn on, and then cut it off then a whole story ...]



    So, let's get started.

    Step 1. We transform the useless CapsLock key into the right Ctrl (RCtrl). Why into it? Because the harmless key, rarely used, does not bother anyone.
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Keyboard Layout]
    "Scancode Map" = hex: 00.00.00.00.00.00.00.00.02.00.00.00.1d, e0.3a, 00.00.00.00.00
    

    After importing the reg file, a reboot is required.

    Step 2. Set AutoHotKey

    Step 3. Write a script (let's name it, for example, keyboardLayout.ahk). I use this option now:

    en: = DllCall ("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
    ru: = DllCall ("LoadKeyboardLayout", "Str", "00000419", "Int", 1)
    ~ <+ RControl :: SetLayout (ru)
    ~> ^ LShift :: SetLayout (en) 
    ~ RControl :: SetLayout (en) 
    #Space :: ChangeLayout () 
    ! Space :: ChangeLayout () 
    SetLayout (language)
    {
      ControlGetFocus, control, A
      PostMessage 0x50, 0,% language%,% control%, A; WM_INPUTLANGCHANGEREQUEST
    }
    ChangeLayout ()
    {
      PostMessage 0x50, 2 ,,, A; WM_INPUTLANGCHANGEREQUEST
    } 
    

    The script, or a link to it, is put into startup.
    Everything can be used (in order not to be overloaded again, you can double-click on the script - AHK will load it).

    English in this case is connected via CapsLock or RCtrl, now anyway. Russian by Ctrl + Shift and Shift + Ctrl. Cyclic switching of all languages ​​installed in the system (not excluding Russian and English) - by Alt + Space or Win + Space. It was possible to leave a regular Windows cyclic switching, but with Ctrl - the laptop problem described above, and on Alt + Shift I was able to get blindly through the times, at best.
    PS As the last attempt to use the standard Windows layout switch: Ctrl + 1 - English, Ctrl + 2 - Russian (the rest in the cycle with a standard combination). Inconveniently. Blindly I do not get.
    Then he used keyla for quite some time . Everything was fine, only under Win7-64bit it works unstably. So while I use homemade.

    Also popular now: