Create keyboard shortcuts for Safari bookmarks

Aug 24, '06 07:30:04AM

Contributed by: HairyPotter

If you have bookmarked a site, for instance macosxhints.com, and visit it frequently, you can save time creating a custom keyboard shortcut to that bookmark. Here is how. First quit Safari, then launch Terminal and type...

defaults write com.apple.Safari NSUserKeyEquivalents \
'{"bookmarkName"="keys";}'
...where bookmarkname is the name you've given the bookmark, and keys is one or more of the following... ...followed by the desired key combination. For example, to set up a bookmark called MacOSXhints with the shortcut Command-Option-X, you should type this in Terminal:

defaults write com.apple.Safari NSUserKeyEquivalents '{"MacOSXhints"="@~x";}'

You can create as many shortcuts as you want at one time just by duplicating the code within the braces. The example below will create two shortcuts, one to Apple site's bookmark (Command-Shift-A) and one to macosxhints' bookmark (Command-Option-X):

defaults write com.apple.Safari NSUserKeyEquivalents '{"MacOSXhints"="@~x";"Macworld"="@$a";}'

[robg adds: This is a nice timesaver over trekking through the Keyboard Shortcuts panel in the Keyboard & Mouse System Preferences panel. I'm pretty sure this should work in both 10.3 and 10.4, but I haven't tested it in 10.3.]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060822131353810