Skip to content

Instantly share code, notes, and snippets.

@reclaimed
Last active January 14, 2026 05:27
Show Gist options
  • Select an option

  • Save reclaimed/4a18d88b445bb80759d85188db2f5db4 to your computer and use it in GitHub Desktop.

Select an option

Save reclaimed/4a18d88b445bb80759d85188db2f5db4 to your computer and use it in GitHub Desktop.
; Switch the input language in Windows 10 (and Windows 8 AFAIR) in the macos way
; Press and release CapsLock to switch the input language (by sending the Win-Space combination)
; Press, hold for half of a second or more, and release CapsLock to toggle the CapsLock status
; (macos toggles the CapsLock status WHILE you hold, will make it that way later)
; Thanks to:
; Castor http://dae.me/blog/1173/pereklyucheniye-yazika-vvoda-po-caps-lock-v-windows/#comment-253278
; Elliot DeNolf https://stackoverflow.com/questions/17396412/autohotkey-script-support-request-to-lock-capslock-key-in-the-on-position
; Replace any previous instance
#SingleInstance force
Capslock::
duration := 0
if (GetKeyState("CapsLock", "P")) {
s := A_TickCount
While (GetKeyState("CapsLock", "P")) {
Sleep 1
}
duration := A_TickCount - s
}
;SoundBeep duration, 50
if (duration<500) {
LayoutSwitch()
} else {
CapsToggle()
}
return
CapsToggle() {
if (GetKeyState("CapsLock", "T")==True)
{
SoundBeep 400, 50
SetCapsLockState, off
return True
}
else if (GetKeyState("CapsLock", "T")==False)
{
SoundBeep 600, 50
SetCapsLockState, on
Return True
}
Return False
}
LayoutSwitch(){
Send {LWin down}
Sleep 20
Send {Space}
Sleep 20
Send {LWin up}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment