Keyboard shortcuts with a single key?
Solution 1:
It is possible to do, both natively and easily. Mac OS X hints has a hint (also check Lri’s comment) on how to set up keyboard shortcuts from the command line. We can use this to create single-key shortcuts.
You’ll need to know the application’s bundle ID (unless you want to set global shortcuts, naturally). For special keys, @
is ⌘; ~
is ⌥; $
is ⇧; ^
is ctrl. You can also check other values.
I’ll use Tweetbot as an example, setting “New Tweet” to ⌥+N, and “Reply” (on the multi-shortcut example) to R.
For one-shortcut commands, you can use the form:
defaults write com.tapbots.TweetbotMac NSUserKeyEquivalents -dict-add "New Tweet" -string "~n"
For multi-shortcut commands, use the form:
defaults write com.tapbots.TweetbotMac NSUserKeyEquivalents '{
"New Tweet"="~n";
"Reply"="r";
}'
For system-wide shortcuts, use -g
, instead of a bundle ID.