I am developing a toolbar for a customer, that wants a traditional IE style toolbar at the top of the window under the address bar.
This is what I have:
What I have http://www.hellometro.com/toolbar/now.png
Notice that because of vertical limitations of the status bar I have to write in all-caps for the letters to be legible while being small enough to fit. (two left most elements in status bar, text field and SEARCH button)
This is what I need:
What I need http://www.hellometro.com/toolbar/whatiwant.png
Notice the toolbar added to the top that has enough vertical space for legible text within text field and button. (Top left below browser’s back button).
I’m looking for a way for positioning the search component at the status bar as a default location, and allow the user to change its position in the options page to let them pick top or bottom (because many if not most Firefox users don’t know they can move Add-ons around).
My question is: Does Firefox Add-on SDK support what I want to do, or do I have to switch languages and approach solution from a different angle?
This isn’t something that you can do with the available Add-on SDK API, with good reason – add-ons shouldn’t waste screen estate unnecessarily and adding a toolbar is just that. You can achieve this goal by using low-level modules and going to the browser’s XUL directly. Something like this should work (untested code and very hacky):
Note the undefined
firstRunvariable – you want to do this only once, otherwise you will revert user’s choice to move your widget elsewhere (you can store a flag viasimple-prefsmodule or something like that). Also note thatbuttonIDcalculation uses internal details from theaddon-kit/lib/widget.jsfile in the SDK – the way the toolbar button ID is calculated can change in a future SDK version but I think that this is the only way to get hold of a widget you create with the SDK. There are plenty of internals in the other parts of the code as well of course.Documentation:
window-utilsmodule (browserWindowIteratoris undocumented),<xul:toolbox>,<xul:toolbar>.