📜 ⬆️ ⬇️

Homemade switch layouts for Windows

Much has been written about switching keyboard layouts, including on Habré. When, a year or two ago, I realized that the usual Ctrl + Shift did not suit me, I, of course , did not reinvent the wheel, but began to look for something that had already been invented on this matter. And temporarily drowned in an ocean of ideas and opinions.
I had two reasons to look for the best. First, wonderful people from the number of laptop manufacturers invented the Fn key on the usual place of the Ctrl key (sometimes this can be fixed in the BIOS). With the normal arrangement of the keys, the Ctrl + Shift combination is typed without looking, and after the improvements everything has become different everywhere. Secondly, additional layouts were needed. And cyclic switching for three or more layouts is a problem, you can forget about automatism.
I tried a lot of options, starting with Punto. All with something not satisfied. In the end, I assembled my own bike based on the AutoHotKey script, which I use. I publish in order to share experiences, without claiming any novelty.
Two main layouts are included deterministically, English - CapsLock, Russian - Shift + CapsLock. The rest of the installed layouts are connected cyclically, considering 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 of Crazybot began to use RusLat . While it works like a clock, and does everything that is necessary, and nothing superfluous (!). Configured CapsLock - English, Shift + CapsLock - Russian, Ctrl + Shift - cyclical switching of other layouts. If the sources were published, it would be amazing in general.]
[ Update. Returned to the "bike" with the reassigned CapsLock. Otherwise, sometimes CapsLock still manages to turn on, and then the whole story is cut down ...]


')
So let's get started.

Step 1. Use the CapsLock key to transform into the right Ctrl (RCtrl). Why in it? Because a 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,00,0,00,00,00,00 d, e0,3a, 00,00,00,00,00


After importing the reg file, a reboot is required.

Step 2. Put the AutoHotKey

Step 3. We write the script (let's call 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 (ru) 
 ~ 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
 } 

We attach the script, or a link to it, to the autoload.
Everything, you can use (in order not to reboot again, you can click on the script with a double click - AHK will load it).

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

Source: https://habr.com/ru/post/170531/


All Articles