(Эта статья также доступна на русском языке).
Also: Switch input language by Caps Lock in Windows.
!!! This method is not yet compatible with macOS 10.12 Sierra !!!
* * *
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:
- You will not be able to use the Caps Lock mode anymore.
- The green light on the actual key will not change as you change the input source.
- 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
- 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.
- In Seil, tick “Change Caps Lock” and in the “keycode” column change 51 to 80:
- Open System Preferences, go to “Keyboard” → click the “Modifier Keys…” button and for the Caps Lock key choose “No action”.
- 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:
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 |
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)
Great guide, thanks!
Thanks so much! This is a fantastic tool for my new Mac!
Hey thanks to you for the last new entry.
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?
Install PCKeyboardHack, map Caps Lock to 52.
Great. Thank you.
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.
Well yeah Anton, it could work but it still replace standard way to switch Spotlight, so not quite good solution.
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)
Pingback: Переключение раскладки клавиатуры в Mac OS клавишей Caps Lock | no more coffee
Works great, thank you very much!
Thank you for the tip.
I actually did step 5 right after step 2. And skipped step 3 completely.
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!
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.
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.
Pingback: Hasznos OSX-es cuccok: váltás a billentyűkiosztások között Caps Lockkal | KTamas' blog
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.
My experience with Yosemite is a bit more depressing – does not work :(
Update: ‘Select the previous input source’ works while ‘Select next source in Input menu’ – does not :\
Thank you! Worked for me like a charm!
Doesn’t work in El Capitan, when I try to change the hotkey to select next input source and press caps lock nothing happens
Works for ‘select previous input source’, which is the same if you only have two input sources.