Skip to content

Instantly share code, notes, and snippets.

@lislon
Created August 24, 2016 12:43
Show Gist options
  • Select an option

  • Save lislon/c166702ee4cd0867b29d04268efc243e to your computer and use it in GitHub Desktop.

Select an option

Save lislon/c166702ee4cd0867b29d04268efc243e to your computer and use it in GitHub Desktop.
/* Copyright (c) 2016 All Rights Reserved
* Igor Avdeev <[email protected]>
*
* Autohotkey utility to make emacs switch input methods with Ctrl+Shift.
*/
#SingleInstance force
#NoTrayIcon
#IfWinActive, ahk_class Emacs
en := DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
; Any combination of Alt And Shift
~Alt & ~Shift up::
;; MsgBox, You pressed and released %A_ThisHotkey%. Prior key is %A_PriorHotkey%, simple key is %A_PriorKey%
; Check if no other then Shift/Alt keys was pressed during C+S combination
if (A_PriorKey = "LShift" or A_PriorKey = "LAlt")
{
;; Send emacs toggle-input-method
Send ^\
;
;; change language to en
PostMessage 0x50, 0, %en%,, A
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment