title: Change OSX keyboard layout("input source") programmatically via terminal or AppleScript?
body: <p>I am currently switching input sources by running a GUI AppleScript through Alfred, and the GUI script can sometime take up to 1s to complete the change. It gets quite annoying at times.</p>
  
  <p>I have come across <a href="https://stackoverflow.com/questions/21597804/determine-os-x-keyboard-layout-input-source-in-the-terminal-a-script">Determine OS X keyboard layout (“input source”) in the terminal/a script</a>. And I want to know since we can find out the current input source if there's a way to change input source <em>programatically</em>? I'd tried overwriting the com.apple.HIToolbox.plist but it does not change the input.</p>
  
  <p>(I do realise there's mapping shortcut to input sources available in the system preference, however I prefer mapping keywords with Alfred)</p>