Search code examples
firefox-addonpositioningxultoolbar

How can I place a Firefox toolbar button close to the address bar


I am developing a Firefox addon with a toolbar button. I would like this button to appear close to the browser's address bar and in the same line or row, either at its left or at its right. For instance, like the page saver addon from Pearl Crescent.

But my code just manages to create an empty new row and places the toolbar button in it. A terrible waste of vertical space.

I am using the following overlay in my xul file:

<overlay id="browseye-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbox id="navigator-toolbox">
    <toolbar id="my-toolbar"
        class="chromeclass-toolbar"
        toolbarname="my Toolbar"
        hidden="false"
        mode="full"
        defaultset="my-toolbar-button"
        persist="hidden collapsed">
        <toolbarbutton id="my-toolbar-button"
            tooltiptext="my Toolbar" 
            orient="horizontal"
            mousethrough="never"
            oncommand="my.onToolbarButtonCommand()">
        </toolbarbutton>
    </toolbar>
</toolbox>    
</overlay>

Could anybody please help me?


Solution

  • You need to add your button to the toolbarpalette tag without adding a new toolbar, see code example in https://developer.mozilla.org/en/XUL_School/Adding_Toolbars_and_Toolbar_Buttons#Adding_a_new_toolbar. Then the user will be able to position your button anywhere using "Customize toolbar" dialog.