Switch TO specific input source
In Mac OS X, there is a keyboard shortcuts to switch between activated input sources.

Is it possible to switch to a specific language? So if you have 3 input methods, you could have 3 shortcuts: Ctrl-1 for English, Ctrl-2 for Spanish and Ctrl-3 for Russian.
macos keyboard-shortcuts keyboard-layout
add a comment |
In Mac OS X, there is a keyboard shortcuts to switch between activated input sources.

Is it possible to switch to a specific language? So if you have 3 input methods, you could have 3 shortcuts: Ctrl-1 for English, Ctrl-2 for Spanish and Ctrl-3 for Russian.
macos keyboard-shortcuts keyboard-layout
Keyboard layout and interface language are independent. And since interface language only applies after restarting a program, anything you gain by a shortcut would be negated by the requirement to restart applications anyway.
– Daniel Beck♦
Dec 20 '10 at 19:09
I am not interested in changing interface languages. Only input languages are of interest.
– Nikem
Dec 20 '10 at 19:13
I streamlined and clarified your question. Please revert if you think I did something wrong (I'm new to doing this).
– Daniel Beck♦
Dec 20 '10 at 19:41
add a comment |
In Mac OS X, there is a keyboard shortcuts to switch between activated input sources.

Is it possible to switch to a specific language? So if you have 3 input methods, you could have 3 shortcuts: Ctrl-1 for English, Ctrl-2 for Spanish and Ctrl-3 for Russian.
macos keyboard-shortcuts keyboard-layout
In Mac OS X, there is a keyboard shortcuts to switch between activated input sources.

Is it possible to switch to a specific language? So if you have 3 input methods, you could have 3 shortcuts: Ctrl-1 for English, Ctrl-2 for Spanish and Ctrl-3 for Russian.
macos keyboard-shortcuts keyboard-layout
macos keyboard-shortcuts keyboard-layout
edited Dec 20 '10 at 19:40
Daniel Beck♦
92.6k12232286
92.6k12232286
asked Dec 20 '10 at 18:56
NikemNikem
23329
23329
Keyboard layout and interface language are independent. And since interface language only applies after restarting a program, anything you gain by a shortcut would be negated by the requirement to restart applications anyway.
– Daniel Beck♦
Dec 20 '10 at 19:09
I am not interested in changing interface languages. Only input languages are of interest.
– Nikem
Dec 20 '10 at 19:13
I streamlined and clarified your question. Please revert if you think I did something wrong (I'm new to doing this).
– Daniel Beck♦
Dec 20 '10 at 19:41
add a comment |
Keyboard layout and interface language are independent. And since interface language only applies after restarting a program, anything you gain by a shortcut would be negated by the requirement to restart applications anyway.
– Daniel Beck♦
Dec 20 '10 at 19:09
I am not interested in changing interface languages. Only input languages are of interest.
– Nikem
Dec 20 '10 at 19:13
I streamlined and clarified your question. Please revert if you think I did something wrong (I'm new to doing this).
– Daniel Beck♦
Dec 20 '10 at 19:41
Keyboard layout and interface language are independent. And since interface language only applies after restarting a program, anything you gain by a shortcut would be negated by the requirement to restart applications anyway.
– Daniel Beck♦
Dec 20 '10 at 19:09
Keyboard layout and interface language are independent. And since interface language only applies after restarting a program, anything you gain by a shortcut would be negated by the requirement to restart applications anyway.
– Daniel Beck♦
Dec 20 '10 at 19:09
I am not interested in changing interface languages. Only input languages are of interest.
– Nikem
Dec 20 '10 at 19:13
I am not interested in changing interface languages. Only input languages are of interest.
– Nikem
Dec 20 '10 at 19:13
I streamlined and clarified your question. Please revert if you think I did something wrong (I'm new to doing this).
– Daniel Beck♦
Dec 20 '10 at 19:41
I streamlined and clarified your question. Please revert if you think I did something wrong (I'm new to doing this).
– Daniel Beck♦
Dec 20 '10 at 19:41
add a comment |
8 Answers
8
active
oldest
votes
I present to you, the ugliest possible "solution":
- Enable support for assistive devices in System Preferences » Universal Access,
- and displaying the Input Sources menu in the menubar in System Preferences » Language and Text.
- Make sure the shortcut
Ctrl-F8is defined for Move focus to status menus in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input. - Make sure the Input Sources menu is the leftmost menu item that can be moved by dragging while holding
Cmddown.
Use AppleScript Editor and write three scripts, each of them with the following code:
tell application "System Events"
key code 100 using control down # press Ctrl-F8
delay 0.5 # wait a bit, UI might be slow
key code 125 # press down to open the menu
keystroke "german" # name of your desired language, in my case tested using German
key code 36 # press enter
end tell
Save once for each language, switching out the name of the language. If you want to press different keys, or assign something different from Ctrl-F8, substitute with the key codes here. You can also move the Input Sources menu from its leftmost position by inserting a few right arrow key presses.
Invoke scripts however you want, e.g. use your application launcher (Quicksilver, Launchbar etc.), or wrap them in Services using Automator, and assign them keyboard shortcuts in System Preferences » Keyboard » Keyboard Shortcuts » Services.
1
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
1
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
1
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
add a comment |
I came up with a bit nicer solution in AppleScript, given you know the name of the Keyboard Layout you want to switch to.
Create a function like this:
on changeKeyboardLayout(layoutName)
tell application "System Events" to tell process "SystemUIServer"
tell (1st menu bar item of menu bar 1 whose description is "text input") to {click, click (menu 1's menu item layoutName)}
end tell
end changeKeyboardLayout
and then call it by
changeKeyboardLayout("English")
changeKeyboardLayout("German")
Be aware that the names of Keyboard Layouts are localized, i.e. on a german system the above example would need to call "Englisch" and "Deutsch".
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
add a comment |
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>
<item>
<name>change_inputsources</name>
<identifier>change_inputsources</identifier>
<autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
<autogen>__KeyToKey__ KeyCode::H, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</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 option-command-E. See the source for the key code values and predefined settings.
add a comment |
I know it's an old question. But even in the end of 2016, I still didn't find a simple and nice solution. Therefore, I made IMEShortcuts, works on Sierra.
You can assign a customized shortcut for any specific input method. Please give it a shot. And if you guys find any bugs, I would happy to help.
Also, Karabiner (known as KeyRemap4MacBook) is a great keyboard customizer for Mac. But it's a little bit complicated and currently broken on Sierra. If you're using Yosemite or El Capitan, it would be another nice choice.
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
add a comment |
I have another solution that has satisfied me the most. KeyRemap4MacBook is application that allows you to remap your keyboard buttons. Among other things it allows for some, not at all exhaustive, support for language change. So we some custom configuration it does what I want.
Cons:
- third party application
- only limited language support for now
Pros:
- Conceptually a little bit nicer that running script on UI
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
add a comment |
On AppleScript you must only take cmd + "space" (or something other, what you change keyboard source).
And all what you need:
key code 49 using command down
49 - code of 'space' button in ASCII for AppleScript.
P.S.: don't forget get access for you AppleScript utility in System Preferences.
add a comment |
Found kawa - quite simple app to fulfill exactly your needs.
Setup shortcuts to directly switch to needed input source.
1
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
add a comment |
This link has a video on how to do it. It already has a hotcake with is "command + space", but the spotlight hot-key is also "command + space". Spotlight over-riders the hot-key, so the language switch doesn't occur. The video in the link will show you how to change the hot-key so that you can toggle the hot-key.
Good Luck,
1
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f224161%2fswitch-to-specific-input-source%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
I present to you, the ugliest possible "solution":
- Enable support for assistive devices in System Preferences » Universal Access,
- and displaying the Input Sources menu in the menubar in System Preferences » Language and Text.
- Make sure the shortcut
Ctrl-F8is defined for Move focus to status menus in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input. - Make sure the Input Sources menu is the leftmost menu item that can be moved by dragging while holding
Cmddown.
Use AppleScript Editor and write three scripts, each of them with the following code:
tell application "System Events"
key code 100 using control down # press Ctrl-F8
delay 0.5 # wait a bit, UI might be slow
key code 125 # press down to open the menu
keystroke "german" # name of your desired language, in my case tested using German
key code 36 # press enter
end tell
Save once for each language, switching out the name of the language. If you want to press different keys, or assign something different from Ctrl-F8, substitute with the key codes here. You can also move the Input Sources menu from its leftmost position by inserting a few right arrow key presses.
Invoke scripts however you want, e.g. use your application launcher (Quicksilver, Launchbar etc.), or wrap them in Services using Automator, and assign them keyboard shortcuts in System Preferences » Keyboard » Keyboard Shortcuts » Services.
1
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
1
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
1
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
add a comment |
I present to you, the ugliest possible "solution":
- Enable support for assistive devices in System Preferences » Universal Access,
- and displaying the Input Sources menu in the menubar in System Preferences » Language and Text.
- Make sure the shortcut
Ctrl-F8is defined for Move focus to status menus in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input. - Make sure the Input Sources menu is the leftmost menu item that can be moved by dragging while holding
Cmddown.
Use AppleScript Editor and write three scripts, each of them with the following code:
tell application "System Events"
key code 100 using control down # press Ctrl-F8
delay 0.5 # wait a bit, UI might be slow
key code 125 # press down to open the menu
keystroke "german" # name of your desired language, in my case tested using German
key code 36 # press enter
end tell
Save once for each language, switching out the name of the language. If you want to press different keys, or assign something different from Ctrl-F8, substitute with the key codes here. You can also move the Input Sources menu from its leftmost position by inserting a few right arrow key presses.
Invoke scripts however you want, e.g. use your application launcher (Quicksilver, Launchbar etc.), or wrap them in Services using Automator, and assign them keyboard shortcuts in System Preferences » Keyboard » Keyboard Shortcuts » Services.
1
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
1
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
1
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
add a comment |
I present to you, the ugliest possible "solution":
- Enable support for assistive devices in System Preferences » Universal Access,
- and displaying the Input Sources menu in the menubar in System Preferences » Language and Text.
- Make sure the shortcut
Ctrl-F8is defined for Move focus to status menus in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input. - Make sure the Input Sources menu is the leftmost menu item that can be moved by dragging while holding
Cmddown.
Use AppleScript Editor and write three scripts, each of them with the following code:
tell application "System Events"
key code 100 using control down # press Ctrl-F8
delay 0.5 # wait a bit, UI might be slow
key code 125 # press down to open the menu
keystroke "german" # name of your desired language, in my case tested using German
key code 36 # press enter
end tell
Save once for each language, switching out the name of the language. If you want to press different keys, or assign something different from Ctrl-F8, substitute with the key codes here. You can also move the Input Sources menu from its leftmost position by inserting a few right arrow key presses.
Invoke scripts however you want, e.g. use your application launcher (Quicksilver, Launchbar etc.), or wrap them in Services using Automator, and assign them keyboard shortcuts in System Preferences » Keyboard » Keyboard Shortcuts » Services.
I present to you, the ugliest possible "solution":
- Enable support for assistive devices in System Preferences » Universal Access,
- and displaying the Input Sources menu in the menubar in System Preferences » Language and Text.
- Make sure the shortcut
Ctrl-F8is defined for Move focus to status menus in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input. - Make sure the Input Sources menu is the leftmost menu item that can be moved by dragging while holding
Cmddown.
Use AppleScript Editor and write three scripts, each of them with the following code:
tell application "System Events"
key code 100 using control down # press Ctrl-F8
delay 0.5 # wait a bit, UI might be slow
key code 125 # press down to open the menu
keystroke "german" # name of your desired language, in my case tested using German
key code 36 # press enter
end tell
Save once for each language, switching out the name of the language. If you want to press different keys, or assign something different from Ctrl-F8, substitute with the key codes here. You can also move the Input Sources menu from its leftmost position by inserting a few right arrow key presses.
Invoke scripts however you want, e.g. use your application launcher (Quicksilver, Launchbar etc.), or wrap them in Services using Automator, and assign them keyboard shortcuts in System Preferences » Keyboard » Keyboard Shortcuts » Services.
answered Dec 20 '10 at 19:28
Daniel Beck♦Daniel Beck
92.6k12232286
92.6k12232286
1
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
1
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
1
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
add a comment |
1
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
1
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
1
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
1
1
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
@Nikem Did it work?
– Daniel Beck♦
Dec 21 '10 at 9:53
1
1
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
Yes, it worked.
– Nikem
Dec 21 '10 at 19:45
1
1
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
Anda, Daniel, although I have chosen another solution, thank you nevertheless for introducing me to Action Script and Services :)
– Nikem
Dec 21 '10 at 19:52
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Nikem You're welcome. Please up-vote my answer by clicking the "up arrow triangle" next to it if you find this answer useful. You can also accept an answer (indicating it is the one answer you like best, and consider your problem solved) by clicking the tick mark next to it. By the way, ActionScript is Adobe, this is AppleScript.
– Daniel Beck♦
Dec 21 '10 at 19:55
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
@Daniel In fact, I don't know which answer to recommend. I have chosen mine, but yours is more widely usable...
– Nikem
Dec 22 '10 at 11:56
add a comment |
I came up with a bit nicer solution in AppleScript, given you know the name of the Keyboard Layout you want to switch to.
Create a function like this:
on changeKeyboardLayout(layoutName)
tell application "System Events" to tell process "SystemUIServer"
tell (1st menu bar item of menu bar 1 whose description is "text input") to {click, click (menu 1's menu item layoutName)}
end tell
end changeKeyboardLayout
and then call it by
changeKeyboardLayout("English")
changeKeyboardLayout("German")
Be aware that the names of Keyboard Layouts are localized, i.e. on a german system the above example would need to call "Englisch" and "Deutsch".
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
add a comment |
I came up with a bit nicer solution in AppleScript, given you know the name of the Keyboard Layout you want to switch to.
Create a function like this:
on changeKeyboardLayout(layoutName)
tell application "System Events" to tell process "SystemUIServer"
tell (1st menu bar item of menu bar 1 whose description is "text input") to {click, click (menu 1's menu item layoutName)}
end tell
end changeKeyboardLayout
and then call it by
changeKeyboardLayout("English")
changeKeyboardLayout("German")
Be aware that the names of Keyboard Layouts are localized, i.e. on a german system the above example would need to call "Englisch" and "Deutsch".
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
add a comment |
I came up with a bit nicer solution in AppleScript, given you know the name of the Keyboard Layout you want to switch to.
Create a function like this:
on changeKeyboardLayout(layoutName)
tell application "System Events" to tell process "SystemUIServer"
tell (1st menu bar item of menu bar 1 whose description is "text input") to {click, click (menu 1's menu item layoutName)}
end tell
end changeKeyboardLayout
and then call it by
changeKeyboardLayout("English")
changeKeyboardLayout("German")
Be aware that the names of Keyboard Layouts are localized, i.e. on a german system the above example would need to call "Englisch" and "Deutsch".
I came up with a bit nicer solution in AppleScript, given you know the name of the Keyboard Layout you want to switch to.
Create a function like this:
on changeKeyboardLayout(layoutName)
tell application "System Events" to tell process "SystemUIServer"
tell (1st menu bar item of menu bar 1 whose description is "text input") to {click, click (menu 1's menu item layoutName)}
end tell
end changeKeyboardLayout
and then call it by
changeKeyboardLayout("English")
changeKeyboardLayout("German")
Be aware that the names of Keyboard Layouts are localized, i.e. on a german system the above example would need to call "Englisch" and "Deutsch".
edited Jan 22 '11 at 17:21
answered Jan 22 '11 at 15:34
AsmusAsmus
1,7991010
1,7991010
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
add a comment |
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
Definitely nicer than mine. I really should learn my AppleScript properly.
– Daniel Beck♦
Jan 22 '11 at 16:24
add a comment |
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>
<item>
<name>change_inputsources</name>
<identifier>change_inputsources</identifier>
<autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
<autogen>__KeyToKey__ KeyCode::H, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</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 option-command-E. See the source for the key code values and predefined settings.
add a comment |
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>
<item>
<name>change_inputsources</name>
<identifier>change_inputsources</identifier>
<autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
<autogen>__KeyToKey__ KeyCode::H, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</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 option-command-E. See the source for the key code values and predefined settings.
add a comment |
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>
<item>
<name>change_inputsources</name>
<identifier>change_inputsources</identifier>
<autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
<autogen>__KeyToKey__ KeyCode::H, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</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 option-command-E. See the source for the key code values and predefined settings.
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>
<item>
<name>change_inputsources</name>
<identifier>change_inputsources</identifier>
<autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
<autogen>__KeyToKey__ KeyCode::H, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</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 option-command-E. See the source for the key code values and predefined settings.
edited Mar 20 '17 at 10:04
Community♦
1
1
answered Apr 27 '13 at 21:39
LriLri
31.2k589130
31.2k589130
add a comment |
add a comment |
I know it's an old question. But even in the end of 2016, I still didn't find a simple and nice solution. Therefore, I made IMEShortcuts, works on Sierra.
You can assign a customized shortcut for any specific input method. Please give it a shot. And if you guys find any bugs, I would happy to help.
Also, Karabiner (known as KeyRemap4MacBook) is a great keyboard customizer for Mac. But it's a little bit complicated and currently broken on Sierra. If you're using Yosemite or El Capitan, it would be another nice choice.
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
add a comment |
I know it's an old question. But even in the end of 2016, I still didn't find a simple and nice solution. Therefore, I made IMEShortcuts, works on Sierra.
You can assign a customized shortcut for any specific input method. Please give it a shot. And if you guys find any bugs, I would happy to help.
Also, Karabiner (known as KeyRemap4MacBook) is a great keyboard customizer for Mac. But it's a little bit complicated and currently broken on Sierra. If you're using Yosemite or El Capitan, it would be another nice choice.
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
add a comment |
I know it's an old question. But even in the end of 2016, I still didn't find a simple and nice solution. Therefore, I made IMEShortcuts, works on Sierra.
You can assign a customized shortcut for any specific input method. Please give it a shot. And if you guys find any bugs, I would happy to help.
Also, Karabiner (known as KeyRemap4MacBook) is a great keyboard customizer for Mac. But it's a little bit complicated and currently broken on Sierra. If you're using Yosemite or El Capitan, it would be another nice choice.
I know it's an old question. But even in the end of 2016, I still didn't find a simple and nice solution. Therefore, I made IMEShortcuts, works on Sierra.
You can assign a customized shortcut for any specific input method. Please give it a shot. And if you guys find any bugs, I would happy to help.
Also, Karabiner (known as KeyRemap4MacBook) is a great keyboard customizer for Mac. But it's a little bit complicated and currently broken on Sierra. If you're using Yosemite or El Capitan, it would be another nice choice.
answered Dec 8 '16 at 6:05
rock9crock9c
411
411
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
add a comment |
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
Thanks for IMEShortcuts! It's very nice. I'd gladly pay $5 or so for it if you added icons to the menubar to show active language (so I wouldn't need to have BOTH IMEshortcuts and the app icon in my menubar taking up space). I would also like to be able to customize the icon used—for example I want to use the Canadian French input because it's closer to US QWERTY, but I want to see a French flag because a Canadian flag doesn't symbolize "French" to me. Those things would make it awesome!
– iconoclast
Oct 26 '18 at 19:47
add a comment |
I have another solution that has satisfied me the most. KeyRemap4MacBook is application that allows you to remap your keyboard buttons. Among other things it allows for some, not at all exhaustive, support for language change. So we some custom configuration it does what I want.
Cons:
- third party application
- only limited language support for now
Pros:
- Conceptually a little bit nicer that running script on UI
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
add a comment |
I have another solution that has satisfied me the most. KeyRemap4MacBook is application that allows you to remap your keyboard buttons. Among other things it allows for some, not at all exhaustive, support for language change. So we some custom configuration it does what I want.
Cons:
- third party application
- only limited language support for now
Pros:
- Conceptually a little bit nicer that running script on UI
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
add a comment |
I have another solution that has satisfied me the most. KeyRemap4MacBook is application that allows you to remap your keyboard buttons. Among other things it allows for some, not at all exhaustive, support for language change. So we some custom configuration it does what I want.
Cons:
- third party application
- only limited language support for now
Pros:
- Conceptually a little bit nicer that running script on UI
I have another solution that has satisfied me the most. KeyRemap4MacBook is application that allows you to remap your keyboard buttons. Among other things it allows for some, not at all exhaustive, support for language change. So we some custom configuration it does what I want.
Cons:
- third party application
- only limited language support for now
Pros:
- Conceptually a little bit nicer that running script on UI
answered Dec 21 '10 at 19:51
NikemNikem
23329
23329
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
add a comment |
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
I didn't find anything related to flexible use of input sources on the web site, only some hard-coded actions related to russian/english. Can you elaborate?
– Daniel Beck♦
Dec 21 '10 at 19:57
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
It's not flexible. It just happens that it supports switching to english and russian (and now estonian), which are the languages I needed. And it allows you to map arbitrary key combinations to those actions. Switching to language in my case.
– Nikem
Dec 22 '10 at 10:44
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
I'm having hard time finding how to set this up with Karabiner.
– Ivan Balashov
Apr 30 '16 at 14:38
add a comment |
On AppleScript you must only take cmd + "space" (or something other, what you change keyboard source).
And all what you need:
key code 49 using command down
49 - code of 'space' button in ASCII for AppleScript.
P.S.: don't forget get access for you AppleScript utility in System Preferences.
add a comment |
On AppleScript you must only take cmd + "space" (or something other, what you change keyboard source).
And all what you need:
key code 49 using command down
49 - code of 'space' button in ASCII for AppleScript.
P.S.: don't forget get access for you AppleScript utility in System Preferences.
add a comment |
On AppleScript you must only take cmd + "space" (or something other, what you change keyboard source).
And all what you need:
key code 49 using command down
49 - code of 'space' button in ASCII for AppleScript.
P.S.: don't forget get access for you AppleScript utility in System Preferences.
On AppleScript you must only take cmd + "space" (or something other, what you change keyboard source).
And all what you need:
key code 49 using command down
49 - code of 'space' button in ASCII for AppleScript.
P.S.: don't forget get access for you AppleScript utility in System Preferences.
answered Jan 28 '17 at 21:59
Ivan TrubnikovIvan Trubnikov
111
111
add a comment |
add a comment |
Found kawa - quite simple app to fulfill exactly your needs.
Setup shortcuts to directly switch to needed input source.
1
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
add a comment |
Found kawa - quite simple app to fulfill exactly your needs.
Setup shortcuts to directly switch to needed input source.
1
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
add a comment |
Found kawa - quite simple app to fulfill exactly your needs.
Setup shortcuts to directly switch to needed input source.
Found kawa - quite simple app to fulfill exactly your needs.
Setup shortcuts to directly switch to needed input source.
answered Jan 20 at 10:24
qwad1000qwad1000
111
111
1
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
add a comment |
1
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
1
1
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
Welcome to Super User. Please read How to Recommend Software then edit your answer to include at least the minimum required information (the items in bold). Posts without this information may be subject to deletion. Thanks for contributing.
– Twisty Impersonator
Jan 20 at 12:38
add a comment |
This link has a video on how to do it. It already has a hotcake with is "command + space", but the spotlight hot-key is also "command + space". Spotlight over-riders the hot-key, so the language switch doesn't occur. The video in the link will show you how to change the hot-key so that you can toggle the hot-key.
Good Luck,
1
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
add a comment |
This link has a video on how to do it. It already has a hotcake with is "command + space", but the spotlight hot-key is also "command + space". Spotlight over-riders the hot-key, so the language switch doesn't occur. The video in the link will show you how to change the hot-key so that you can toggle the hot-key.
Good Luck,
1
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
add a comment |
This link has a video on how to do it. It already has a hotcake with is "command + space", but the spotlight hot-key is also "command + space". Spotlight over-riders the hot-key, so the language switch doesn't occur. The video in the link will show you how to change the hot-key so that you can toggle the hot-key.
Good Luck,
This link has a video on how to do it. It already has a hotcake with is "command + space", but the spotlight hot-key is also "command + space". Spotlight over-riders the hot-key, so the language switch doesn't occur. The video in the link will show you how to change the hot-key so that you can toggle the hot-key.
Good Luck,
answered Dec 20 '10 at 19:06
DavidDavid
6,67662648
6,67662648
1
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
add a comment |
1
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
1
1
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
He already knows how to switch between languages, he wants to switch to a specific one, since he probably has more than 2 activated.
– Daniel Beck♦
Dec 20 '10 at 19:08
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Yes, exactly as Daniel said. I have 3 input languages and need to to select a specific one.
– Nikem
Dec 20 '10 at 19:14
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
Sorry... I must have misunderstood the question. I thought you were trying to make a way to toggle between languages with a hot-key.
– David
Dec 20 '10 at 21:05
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f224161%2fswitch-to-specific-input-source%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Keyboard layout and interface language are independent. And since interface language only applies after restarting a program, anything you gain by a shortcut would be negated by the requirement to restart applications anyway.
– Daniel Beck♦
Dec 20 '10 at 19:09
I am not interested in changing interface languages. Only input languages are of interest.
– Nikem
Dec 20 '10 at 19:13
I streamlined and clarified your question. Please revert if you think I did something wrong (I'm new to doing this).
– Daniel Beck♦
Dec 20 '10 at 19:41