Keyboard shortcut for jumping directly to a specific input method
I'm leaning Japanese, and so I have my Mac set up for three different input methods: English, and two different Japanese character sets. I can change between the three input methods using ctrl-alt-option-space.
However, because there are three input methods I have to press this key combination a different number of times depending on what the current state is. For example, if I want to switch back to English then I have to press it twice if it's currently set to hiragana, but only once if it's set to katakana. Because of this, I keep pressing it the wrong number of times, which results in typing unwanted characters and then having to cycle back through the three input methods to get to the one I want.
So instead of using one key combination to cycle through the three input methods, I'd like to set up a specific key press for each one. For example, I'd like to set up something like ctrl-alt-command-E that always switches back to English, no matter what the current input method is, so that I can always get to where I want to be without worrying about where I am. But I can't seem to find a way to do this. Is it possible?
Solution 1:
One option would be to download changeInput and assign shortcuts to shell commands like changeInput U.S.
.
You could also use KeyRemap4MacBook:
<?xml version="1.0"?>
<root>
<vkchangeinputsourcedef>
<name>KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</name>
<inputsourceid_equal>com.apple.inputmethod.Kotoeri.Japanese</inputsourceid_equal>
</vkchangeinputsourcedef>
<vkchangeinputsourcedef>
<name>KeyCode::VK_CHANGE_INPUTSOURCE_KATAKANA</name>
<inputsourceid_equal>com.apple.inputmethod.Kotoeri.Japanese.Katakana</inputsourceid_equal>
</vkchangeinputsourcedef>
<item>
<name>change_inputsources</name>
<identifier>change_inputsources</identifier>
<autogen>__KeyToKey__ KeyCode::E, VK_CONTROL | VK_OPTION | VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
<autogen>__KeyToKey__ KeyCode::H, VK_CONTROL | VK_OPTION | VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</autogen>
<autogen>__KeyToKey__ KeyCode::K, VK_CONTROL | VK_OPTION | VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_KATAKANA</autogen>
</item>
</root>
See the private.xml documentation.
VK_CHANGE_INPUTSOURCE_ENGLISH is defined in vkchangeinputsourcedef.xml. You can see the IDs of input sources from EventViewer.app. Without | ModifierFlag::NONE
for example the first setting would also apply to control-option-shift-command-E. See the source for the key code values and predefined settings.