Change keyboard layout on a Mac using a hotkey

Windows supports keyboard shortcuts to set a specific keyboard layout or to cycle through them. Not so with MacOS X 😦

With Spark, and the following Applescript, I can at least set a layout. Cycling through is a bit more difficult.

changeInputLanguage("U.S.") -- change "U.S." to your own needs

on changeInputLanguage(L)
tell application "System Events" to tell process "SystemUIServer"
tell (1st menu bar item of menu bar 1 whose value of attribute "AXDescription" is "text input")
return {its value, click, click menu 1's menu item L}
end tell
end tell
end changeInputLanguage

The code comes from

This entry was posted in Mac. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s