1
votes

I have used Linux and KDE for a long time and my muscle memory wants to switch keyboard layouts by pressing both shift keys simultaneously. Can I use AutoHotKey to implement that on Windows?

I lack two pieces of information:

  1. How do I remap "both shift keys pressed at the same time"? I can use + to capture the pressing of one shift key, but how about both?

  2. How can I send the key combination that Windows uses to switch layouts (Ctrl+Shift in my current setup)? More generally, how can I remap something to a key combination?

2

2 Answers

2
votes

Use combo key notation and L/R prefix, see the documentation (or the help file):

LShift & RShift::send {LShift down}{LCtrl down}{LShift up}{LCtrl up}
1
votes

I wanted to disable native Windows hotkey altogether. The following works well so far, including console windows.

~RShift & ~LShift::
~LShift & ~RShift::
INPUTLANGCHANGE_FORWARD := 0x2
WM_INPUTLANGCHANGEREQUEST := 0x0050
WinGet, windows, List
Loop % windows {
  PostMessage WM_INPUTLANGCHANGEREQUEST, INPUTLANGCHANGE_FORWARD, % Lan, , % "ahk_id " windows%A_Index%
}
return