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?
Asked
Active
Viewed 3,839 times
4
studiohack
- 13,468
- 19
- 88
- 118
Kevin Burke
- 899
- 3
- 13
- 30
-
See [Mac OS X: how do I change to Qwerty / Dvorak with a terminal command?](http://superuser.com/questions/173494/mac-os-x-how-do-i-change-to-qwerty-dvorak-with-a-terminal-command), [Switch TO specific input source](http://superuser.com/questions/224161/switch-to-specific-input-source) and [How to I use Apple Script to change the keyboard layout on Snow Leopard?](http://superuser.com/questions/235759/how-to-i-use-apple-script-to-change-the-keyboard-layout-on-snow-leopard). – Lri Jun 24 '11 at 03:35
-
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 03:36
1 Answers
1
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'
Kevin Burke
- 899
- 3
- 13
- 30