How can I change the keyboard layout to Dvorak on a mac, using the terminal? What is the defaults write setting for the keyboard layout?

link|improve this question

An answer in the third question suggests something like plist=$(find ~/Library/Preferences/ByHost/com.apple.HIToolbox.*); defaults write ${plist%.*} AppleCurrentKeyboardLayoutInputSourceID -string com.apple.keylayout.US; killall SystemUIServer. I couldn't get that to work myself though. – Lri Jun 24 '11 at 3:36
feedback

1 Answer

up vote 1 down vote accepted

This snippet did the trick for me. Note that I use Quicksilver to launch apps, so I remapped the keyboard shortcut for "switch input menu" from Cmd+Space to Option+Cmd+S.

osascript -e 'tell application "System Events"' \
          -e 'keystroke "s" using {command down, option down}' \
          -e 'end tell'
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.