Application-specific default keyboard layout in Mac OS X

12

3

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

Yaelcita

Posted 2010-06-27T05:38:46.323

Reputation: 121

Answers

10

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

user31752

Posted 2010-06-27T05:38:46.323

Reputation:

This answer is outdated! There is no such option for Yosemite. check mine answer: http://superuser.com/a/889096/230571

– skywinder – 2015-03-19T17:58:52.150

2The 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 – 2018-03-20T19:22:35.490

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 – 2013-01-06T16:39:39.633

5

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.

Gleb Gusev

Posted 2010-06-27T05:38:46.323

Reputation: 61

5Hi Gleb! Could you please expand your answer and explain how it solves the problem, what it does, etc.? – slhck – 2012-10-16T13:33:53.277

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 – 2014-01-16T19:56:13.370

4

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!

skywinder

Posted 2010-06-27T05:38:46.323

Reputation: 193

1Maybe once it was free but now it's not – Evmorov – 2016-05-07T10:25:52.083

And now it's even not available, or maybe it just for my region... – Andrey Semakin – 2019-12-21T17:19:40.333

1

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

Vuong

Posted 2010-06-27T05:38:46.323

Reputation: 11

1

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.

Alissa

Posted 2010-06-27T05:38:46.323

Reputation: 111

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 – 2017-06-30T14:33:35.327

1

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:

jsejcksn

Posted 2010-06-27T05:38:46.323

Reputation: 2 854