Select input language by Caps Lock in Mac OS X

(Эта статья также доступна на русском языке).
Also: Switch input language by Caps Lock in Windows.

* * *

I found a new way to bind input language (input source) switch to the Caps Lock key in Mac OS X. The main advantage of this method is absense of lag, so input source changes almost instantly when you hit the Caps Lock key. You will admire this if you’re a fast typer.

The logic is simple: first, I map the F19 key to input source selection. Then, using Seil (previously called PCKeyboardHack), I remap the Caps Lock key to F19. This works regardless of your keyboard having the F19 key. You can also keep the default combination (Cmd+Space) if you wish.

Cons:

  1. You will not be able to use the Caps Lock mode anymore.
  2. The green light on the actual key will not change as you change the input source.
  3. You will have to remove any software incompatible with Seil.

If this method doesn’t work for you, you will be able to revert all changes at any point.

Step-by-step guide

  1. Download, install and launch Seil. By default it goes to “Applications” folder. You’re too lazy to look for it there, find it using Spotlight.
  2. In Seil, tick “Change Caps Lock” and in the “keycode” column change 51 to 80:
    Change Caps Lock Keycode
  3. Open System Preferences, go to “Keyboard” → click the “Modifier Keys…” button and for the Caps Lock key choose “No action”.
    Caps Lock No Action
  4. Switch to “Keyboard Shortcuts” tab in the same window, select “Input Sources” and find “Select the previous input source” (or “next source”, does not matter). Double click the shortcut to change it. Hit Caps Lock. Here is how it should look like eventually:
    Bind Change Layout To F19

Done!

For advanced users

You may use any other key in the range F13—F18 instead of F19. To do this, in the second step substitute 80 with a different keycode according to the following table:

Key Keycode
F13 105
F14 107
F15 113
F16 106
F17 64
F18 79
F19 80
This entry was posted in How to’s and tagged , , , . Bookmark the permalink.

23 Responses to Select input language by Caps Lock in Mac OS X

  1. Thank you for useful information.

    Changing language by the one-shot push of the Command key is also convenient, try it if interested.
    http://pqrs.org/macosx/keyremap4macbook/files/KeyRemap4MacBook-6.5.55.pkg.zip

    For Russian > Change Command_L Key > Command_L to Command_L (+ When you type Command_L only, change inputmode to english)
    For Russian > Change Command_R Key > Command_R to Command_R (+ When you type Command_R only, change inputmode to russian)

  2. Niklas Rosen says:

    Great guide, thanks!

  3. Emily says:

    Thanks so much! This is a fantastic tool for my new Mac!

  4. Hey thanks to you for the last new entry.

  5. Zeljko Babic says:

    Thanks for the effort, but I would like to map CapsLock to return or enter. I didn’t find that info on the web. Is that be possible?

  6. Anton says:

    I moved to Mac OS X three days ago and found a much easier way to do it:
    Install Punto Switcher for Mac (which works waaaaaaaaaay better than Kirgudu btw);
    Select Ctrl or ⌘Command as your layout switch button;
    In Modifier Keys menu (keyboard options) assign Caps Lock to that selected button (⌘ in my case);
    Done!

    No hacks, no extra software, works like a charm, enjoy.

    • Gleb says:

      Well yeah Anton, it could work but it still replace standard way to switch Spotlight, so not quite good solution.

  7. Gleb says:

    In my case this hack seems changing layout, at least I see it in toolbar BUT it does not actually change layout while I’m typing something it’s still same layout that was before pressing CapsLock. “Enable CapsLock LED Hack” does not help, led is on always now :(
    Does anybody knows what it can be? (I’m a Leopard user)

  8. Pingback: Переключение раскладки клавиатуры в Mac OS клавишей Caps Lock | no more coffee

  9. Sergey says:

    Works great, thank you very much!

  10. Alexey says:

    Thank you for the tip.

    I actually did step 5 right after step 2. And skipped step 3 completely.

  11. Alex says:

    It seems that this feature does not work after upgrading to Mac OS 10.8 (Mountain Lion). Looks like caps lock cannot be bound to F19 any more. I had to change language switching to F1 (hope that it’s temporary).

    If anyone has the same problem and has got the solution, I’ll be glad to hear it.

    Cheers!

  12. Alex says:

    I finally made it working on 10.8!

    The solution is a bit hacky, but still works. See the instructions here:
    https://github.com/tekezo/PCKeyboardHack/issues/8#issuecomment-6940640

    OSX 10.8 users will have to wait for a new version of PCKeyboradHack to get a smooth ‘out-of-box’ patch, but this one is at least something for now.

  13. Mike says:

    Did just the same a few days ago. Even the key — f19 — I’ve used it too :-)

    But why there is an unnecessary step with apple script?

    You FIRST change the caps lock to F19, then you assign f19 to change the language by just hitting caps.

  14. Pingback: Hasznos OSX-es cuccok: váltás a billentyűkiosztások között Caps Lockkal | KTamas' blog

  15. Alex says:

    For others wondering if this still works – it does and does so like a charm (Yosemite)
    PCKeyboardHack is now called Seil, the rest is the same.

  16. Ivan says:

    My experience with Yosemite is a bit more depressing – does not work :(

  17. Roman Tereshin says:

    Thank you! Worked for me like a charm!

  18. budkin says:

    Doesn’t work in El Capitan, when I try to change the hotkey to select next input source and press caps lock nothing happens

Leave a Reply

Your email address will not be published. Required fields are marked *