This is great and goes along with my Terminal podcast. Thanks for posting!
On May 14, 2008, at 4:52 PM, David Truong wrote:
Taken from: http://www.mactipper.com/2008/02/add-keyboard-shortcuts-from-command.htmlWhen I installed Leopard, I lost the functionality (for some odd reason) toadd keyboard shortcuts via the System Preferences "Keyboard & Mouse" preferencepane. Well, here's a way to add keyboard shortcuts through the command line.By using the template:defaults write com.apple.App NSUserKeyEquivalents '{"Menu Item"="@n";}'we can make a keyboard shortcut for a lot of different apps. We change the com.apple.App to the name of the application (case sensitive) and we usethesesymbols near the end to represent the modifier keys that one would press:• @ = Command • $ = Shift • ~ = Option • ^ = ControlSo, to make a keyboard shortcut in Mail to show the Photo Browser, you wouldfirst quit Mail, then type into the Terminal: defaults write com.apple.Mail NSUserKeyEquivalents '{"Photo Browser"="@$p";}'Which means that when we open up mail again, we can hit Cmd-Shift-P to openthe photo browser.As another example, if, in Safari, you wanted to make the Google Search boxselectable with Cmd-K (the firefox default) and you wanted "Reopen All Windows From Last Session" to be Cmd-Shift-R, you could use: defaults write com.apple.Safari NSUserKeyEquivalents '{"Google Search…"="@k";"Reopen All Windows From Last Session"="@$r";}'Note that you have to have a ; between the two terms and at the end of the{}.Finally, to remove a command edit (change Cmd-K back to Cmd-Option-F in Safari) simply replace the "@k" in the previously given command to "" andget rid of the "Reopen...ion"="@$r"; so that you end up with: defaults write com.apple.Safari NSUserKeyEquivalents '{"Google Search…"="";}'Note, however, that the ... in "Google Search..." is actually an elipsiswhich is typed using Alt-;.As a final comment, to add a keyboard shortcut for every application, youwould use: defaults write NSGlobalDomain NSUserKeyEquivalents '{"Send Selection"="@~$i";}'and obviously replace the "Send Selection" with your command and the "@~$i" with the shortcut. BTW, the given command will set the "Send Selection" item in the App_Name>Services>Mail> menu to Cmd-Option-Shift-i so that you canselect some text and pop it into an email with a simple shortcut.Well, that's all for now. Thanks for reading and come back on Sunday formore Mac tips from The MacTipper Blog!Click on the link below to go to our homepage. http://www.icanworkthisthing.comManage your subscription by using the web interface on the link below.//www.freelists.org/list/macvoiceover Users can subscribe to this list by sending email to macvoiceover-request@xxxxxxxxxxxxx with 'subscribe' in the Subject field OR by logging into the Web interface at //www.freelists.org/list/macvoiceover
Click on the link below to go to our homepage. http://www.icanworkthisthing.com Manage your subscription by using the web interface on the link below. //www.freelists.org/list/macvoiceover Users can subscribe to this list by sending email to macvoiceover-request@xxxxxxxxxxxxx with 'subscribe' in the Subject field OR by logging into the Web interface at //www.freelists.org/list/macvoiceover