Force language change on focus into terminal Is there any way of forcing input language set to default one on terminal/iterm focus?

Basically what I want to achieve is setting current keyboard input language to English on switching back from other programs.
Scripting solutions would work as well.
Couldn't find a in-built preferences settings in iTerm. But you can use the KeyBoard Maestro to achieve it. If you don't have then download from the official site.


Open KeyBoard Mestro.
Create a group in Groups section (to hold all your specific automating processes).
Now create a macro with the name Set iTerm Application Language.

a. Add New Trigger -> The focussed window -> The focussed window changes

b. Add another trigger -> This application -> Select iTerm -> Select Active -> Repeating every 1 seconds.

c. Add New Action -> Select Set KeyBoard Layout -> Select the keyboard layout (i.e., language preference).





Now create another macro with the name Set Other Application Languages.

a. Repeat a in previous macro.

b. Add another trigger -> This application -> Select Any Application -> Select Activates.

c. Repeat c from previous macro.




You are all set. While switching windows between iTerm and others, you can see the keyboard preference icon changing in the top menu bar on the right corner.

Note : The keyboard layouts will appear only if they are added in System Preferences -> Language &amp; Region -> Input Sources.
And the names of the macros can be anything. If you wish to deactivate the triggers, disable them by clicking the Tick mark on top-right side.