Created
August 24, 2016 12:43
-
-
Save lislon/c166702ee4cd0867b29d04268efc243e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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