I know how to change the keyboard layout in general, but I want certain applications to always open with a specific layout, not the same for all of them. For example, I'd like Firefox to open with a Spanish layout, but Mathematica with a US layout. How can I do this?

I'm using Snow Leopard


I think the easiest solution is to add a bit of manual work and do it as follows:

  • Turn on the languages you want in System Prefs > Language & Text > Input Sources
  • Under "Input source options" select the "Allow a different one for each document"
  • Set up a keyboard shortcut to change keyboard layout
  • Launch your app, change your keyboard layout, and it will only be changed for that window.
  • If you bring up a new firefox window, you'll need to re-select the language for that new window.

To answer your specific desire to have apps open in one layout:

  • Set the "Allow a different one for each document" as directed above.
  • Find out how to change the layout via script. Solutions seem available...
  • Make a new launcher (AppleScript) for Firefox that launches Firefox, then runs the keyboard changer after a delay (when you are sure Firefox is open and in front).
  • Perhaps this is good enough as doing it at launch meets your needs. If not, run it continuously as @pattern86 suggested
| improve this answer | |
  • Thank you! I've looking for a way to do this for a couple months now. Safari would always switch the keyboard layout on its own, drove me nuts. – Ory Band Jan 6 '13 at 16:39
  • This answer is outdated! There is no such option for Yosemite. check mine answer: superuser.com/a/889096/230571 – skywinder Mar 19 '15 at 17:58
  • 2
    The option is now back in OS X High Sierra, but rephrased to "Automatically switch to a document's input source". I found that very useful. – MKT Mar 20 '18 at 19:22

I suggest you to try Keyboard pilot.

The app is sold in Mac OS App Store for a small price. It allows you to set a list of app->layout pairs which forces active layout to change when the specified app gains focus.

| improve this answer | |
  • 5
    Hi Gleb! Could you please expand your answer and explain how it solves the problem, what it does, etc.? – slhck Oct 16 '12 at 13:33
  • I had this same problem, and went ahead and bought keyboard pilot and it indeed solved the problem, it just switches the layout when you switch applications. – Guillermo Siliceo Trueba Jan 16 '14 at 19:56

The top-voted answer is outdated! There is no such option for Yosemite.

I found great and free application, that resolve this issue: Auto Keyboard

By this app you can specify default language for any specific app - simply awesome!

| improve this answer | |
  • 1
    Maybe once it was free but now it's not – Evmorov May 7 '16 at 10:25
  • And now it's even not available, or maybe it just for my region... – Andrey Semakin Dec 21 '19 at 17:19

You can write an Applescript that constantly runs and checks if an app has focus and if it does then it sets the keyboard layout to one layout and when it detects that the app doesn't have focus it switches the layout back again. Have it run at login.

I can't help with writing the app, but that would be the solution.

Here are a couple of related articles that I found:

| improve this answer | |

I suggest you to try Keyboard Maestro at https://www.keyboardmaestro.com/main/.

By this app you can specify default input source for any specific app - simply awesome!

Check my screenshot:

enter image description here

| improve this answer | |

It is not exactly answer for the question asked (as it only works for Russian and English), but I want it to be here, for those who will search for such an app in future. Punto Switcher by Yandex has checkbox to remember layout per application. And you can turn off automatic layout switching based on what you are typing.

| improve this answer | |
  • Punto switcher is a small utility, basic functionality of it is fixing text typed in wrong layout. It also can remember layout per application. And it's not a plugin for some other app, it's a standalone tool... I don't see how it 'depends on the application itself'. – Alissa Jun 30 '17 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.