Safari-like Bookmarklet Toolbar Behavior in Firefox 3

DON'T post new tutorials here! Please use the "Pending Submissions" board so the staff can review them first.
Post Reply
User avatar
un0wn
forum buddy
forum buddy
Posts: 21
Joined: 09 Feb 2009, 17:00
15

Safari-like Bookmarklet Toolbar Behavior in Firefox 3

Post by un0wn »

Safari-like Bookmarklet Toolbar Behavior

un0wn copyleft Feb 2009 ov3rload AT gmail DOT com

// Please leave this header intact and do not modify.

There's a few things in firefox that just do not satisfy my needs and they have been the reason I have not made Firefox my default browser. One of those issues is the handling of the Bookmarks Toolbar folder. In Firefox, unlike Safari, there is no hotkey set to the toolbar items. While this has
generally not been a problem, I still find myself wishing I could use my bookmarklets with the ease I have found in Safari. The following is a guide, through the use of external addons, to retain the functionality that Safari has within Firefox 3. Theoretically, these steps should be reproducible on both Windows, Linux, and Mac systems. However, I have only tested it on my Mac and the location of the .js file that needs to be editted will most likely vary.

On the mac, the prefs.js file is located in /Users/<your username>/Libaray/Application Support/Firefox/Profiles/<your profile>

Step 1.
Download Keyconfig.xpi
This can be found here: http://mozilla.dorando.at/keyconfig.xpi

This addon is beyond awesome. It lets you change, modify and add hotkeys within Firefox. By default, the dialog with which t do so is hidden, however, so we'll have to bring that up to see all the hotkeys.

Step 2.
Quit firefox. Create a new Firefox profile.

This step is crucial. I would never recommend working on your existing profile before trying out the edit on a clean profile. This is to make sure that you don't inadvertantly mess something up. Name it something that is different from your main profile, so its easier to distinguish.

Step 3.
Find the location of the prefs.js file. Normally, this file should not be editted. Again, it's crucial that Firefox is closed while this file is being editted. Open the file in a text editor. BBedit is a good one on the Mac side.

Step 4.
Paste the following line into the prefs.js file.

Code: Select all

user_pref("keyconfig.main.xxx_key__Keyword 1", "!][][][if(window.loadURI) loadURI(getShortcutOrURI('BOOKMARKLET_KEYWORD',{}));");
what this does is create a preference in your About:config.

keyconfig.main.xxx_key__Keyword 1
this line, creates the preference for the addon Keyconfig naming it Keyword 1. If you'd it to be called something else, you can modify everything after key__.

The second part of this preference is the functional part which calls the bookmark you have set a keyword for in your bookmarks.
getShortcutOrURI('BOOKMARKLET_KEYWORD',{}));");
As you guessed, you edit the BOOKMARKLET_KEYWORD to whatever keyword you want. This is the same keyword that you will add to the actual bookmark in Firefox.

Step 5.
Save and close the prefs.js file.

Step 6.
Open Firefox with the profile you made earlier.

Step 7.
Open the Bookmarks Organizer and go to the Bookmarks Toolbar location.

Step 8.
Click on more. Under keyword, add the keyword you added in the prefs.js file earlier to one of your bookmarks.

Step 9.
Type Shift-Command-F12 to bring up the keyconfig keybinding dialog.

This is where you'll set the keybind you wish to use. I recommdend using the same as Safari, but you may want to choose your own. Safari uses Command-1, 2 etc. In Firefox, Command-1 is set to bring up tabs. So in order to use this, we'll need to disable the current ones so they won't conflict.

Step 10.
In the Keyconfig dialog, select the 'KeySelectTab_1' binding, press disable. Repeat this for all the tab preferences.

Step 11.
Close and Reopen Firefox.

Post Reply