Skip to content

Instantly share code, notes, and snippets.

@bdeshi
Created February 17, 2020 13:04
Show Gist options
  • Save bdeshi/b073d4bfd98f0c77f7f137750851ac56 to your computer and use it in GitHub Desktop.
Save bdeshi/b073d4bfd98f0c77f7f137750851ac56 to your computer and use it in GitHub Desktop.
switch windows keyboard layouts with super/windows key + space
/*
i use **super+space** to switch keyboard layouts in my linux desktop.
sadly windows does not have this as an option. this script enables that shortcut.
disable windows' own hotkey in language settings, then run this script at startup, and win!
*/
#NoEnv
#Persistent
;#NoTrayIcon
#SingleInstance Force
#InstallKeybdHook
#UseHook On
#KeyHistory 0
SetBatchLines -1
WM_INPUTLANGCHANGEREQUEST := 0x50
INPUTLANGCHANGE_BACKWARD := 0x0002
INPUTLANGCHANGE_FORWARD := 0x0004
INPUTLANGCHANGE_SYSCHARSET := 0x0001
^Space::
PostMessage, %WM_INPUTLANGCHANGEREQUEST%, %INPUTLANGCHANGE_FORWARD%,,, A
/*
| WM_INPUTLANGCHANGEREQUEST(
| wParam = new_locale_id|BACKWARD 0x0004|FORWARD 0x0002|SYSCHARSET 0x0001,
| lParam = locale_id // optional
| ) // https://docs.microsoft.com/en-us/windows/desktop/winmsg/wm-inputlangchangerequest
*/
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment