Adding add-on preferences to the Add-ons Manager

For some time now Firefox for mobile has had this nice feature where add-ons could embed their preferences right into the list of add-ons, no need to open a whole a new window like add-ons for desktop have to. During the development of Firefox 4 we were a little jealous of what the mobile team had done and so we drew up some ideas for how the same functionality would look on desktop. We didn’t get time to implement them then but I’m excited that someone from the community stepped up and implemented it for us. Not just that but he made the code shared between mobile and desktop, added some new option types and made it work fine for restartless add-ons which are unable to register their own chrome.

The basic idea is simple. Create a XUL file containing a list of <setting> elements. Different types of settings are possible, checkboxes, input boxes, menulists, buttons, etc. Each one shows up as a row in the details view for an add-on in the add-ons manager. The XUL file can either be just added to your XPI (call it options.xul) or referenced by the optionsURL option in your install.rdf.

Get it right and you’ll see something like this:

I want to thank Geoff Lankow (darktrojan on IRC) for his awesome work getting this done. This feature is now in the Aurora builds and it’d be great to get add-on developers playing with it. Geoff even wrote up some detailed docs to help you out.

As a bonus Geoff also implemented support for in-tab preferences. This makes Firefox load an add-ons options UI in a new tab instead of a new window. Setting the optionsType property to 3 enables this.

13 thoughts on “Adding add-on preferences to the Add-ons Manager”

  1. Awesome! I really like this idea as it is always hard to figure out where the options are. The mobile firefox does an awesome job of showing these values along with the addon in the “add-on” tab. It makes more sense for the desktop version to have to. 🙂 🙂
    Could you please release it with FF 6?? It would be amazing!

    1. Not at the moment, it’s designed to be simplified preferences. Buttons can be used to open more detailed sections if necessary.

    1. No there isn’t, I’m not sure why you’d want to though. Do you expect users to not try to configure an add-on if it doesn’t have inline preferences?

      1. No. What I mean is that if an addon’s preferences are not inline, it’s useless to click “More…” to get at them, what I need to click in that case is “Preferences”, which will give me out-of-line preferences.

        1. In both cases you can click “Preferences” and it should do the right thing.

Comments are closed.