Using Add-on SDK to add toolbar buttons? Integrating XUL and Add-on SDK for Firefox Add-ons?
Asked Answered
W

3

10

I have already coded most of a Firefox add-on using the Add-on SDK API. I am now discovering that Add-on SDK might not be powerful enough for my purposes. I need two things:

  1. A drop down button in the toolbar next to the location bar.
  2. To modify the add-ons manager in firefox

It is truly disappointing, but I don't believe either of these is possible with the Add-on SDK.

First of all, I understand there is a widget module in the Add-on SDK API. But this only allows me to add a simple icon or label to the awkward add-on bar. What if I need to add a nicer button like the one next to the location bar for Firebug or Greasemonkey? As for modifying the add-ons manager in firefox, I have tried Nickolay Ponomarev's XUL with the Add-on SDK without any success whatsoever. If anyone knows how to get this working and can point me in the right direction that would be extremely helpful (cfx init --template xul doesn't do anything the regular SDK does when I try it)

Winnow answered 6/10, 2011 at 4:23 Comment(4)
Add-ons should add their icon to the add-on bar, that's the official recommendation for all extensions starting with Firefox 4. If the user wants to clutter his other toolbars he can customize them and drag icons around - that should work for SDK add-ons as well.Hernardo
As to modifying the add-on manager: you provide absolutely no information as to what you are trying to achieve, and asking two questions at once is not a good idea anyway. I suggest that you edit your question to ask about toolbar buttons only and move add-on manager modification into a separate question.Hernardo
@WladimirPalant thanks for the suggestions. I think many firefox users are still uncomfortable moving icons around. I'm afraid people will not like the default position of my add-on menu on the add-on bar, and will simply close the bar as a whole rather than going through the trouble of relocating.Winnow
It is worth noting that the SDK project recognizes that the current situation is awkward; we have some thought on how to improve this in the future, specifically around location bar ui. Some of the emerging ideas I've seen arounf Firefox UX contain additional UI affordances for add-ons.Snipe
S
3

Have you looked at Erik Vold's toolbarbutton module?

https://github.com/erikvold/toolbarbutton-jplib/

It is possible to access all of Firefox's internal apis in SDK modules by requiring chrome privileges; it just won't be as easy as the addon-kit high level apis.

Snipe answered 6/10, 2011 at 5:9 Comment(3)
I haven't seen this, but it looks very useful. Perhaps I can use this as a model for changing the add-on manager as well. Thank you!Winnow
You can certainly modify the EM with SDK modules, I was going to do that myself, so if you have started something then please let me know!Whatsoever
(The supplied link is dead)Silverside
J
2

The toolbarbuttonlib-jplib referenced above no longer exists, but try toolbarwidget-jplib. It works like a charm! Total life saver.

Journalize answered 18/2, 2014 at 21:33 Comment(0)
C
1

tried Nickolay Ponomarev's XUL with Jetpack without any success whatsover. If anyone knows how to get this working and can point me in the right direction that would be extremely helpful (cfx init --template xul doesn't do anything the regular sdk does when I try it)

I would very much like to hear the detailed description of what you tried and how exactly it failed. I can't answer the question in its current form.

I don't believe either of these is possible with JetPack.

You mean using only the built-in high-level SDK modules. It's possible to write a low-level SDK module that uses XPCOM and interacts with chrome code directly to implement the features you need -- after all that's how the rest of SDK modules are implemented. If you go this route you lose the future compatibility promise of the SDK though -- you'll have to either get it included in the upstream SDK or to update it for the newer Firefox versions yourself.

Cathouse answered 9/10, 2011 at 10:16 Comment(5)
Thanks for your reply. I downloaded 1.0b1rc4 from your github fork of the add-on sdk and ran source bin/activate. Then, when I run cfx init --template xul in a new folder, I don't get the extension folder mentioned (alongside lib, tests, etc) I don't get any of the files mentioned in the section "Pre-generated files in a XUL-based add-on" not even the changes to the package.json file. The instructions seem clear but I'm not getting the expected results.Winnow
@Salami: OK, I'm suspecting the download step. Did you use the "ZIP" button on the github page to download? You may have downloaded the 'base' version of the code, not the fork. Try github.com/nickolay/addon-sdk/zipball/… (or better yet clone with git).Cathouse
Thank you. This 0.9 version you linked seems to be working greatWinnow
@Nickolay: Has the -t xul or --template xul flag been superseded by --templatedir=xul?Col
@SmileAndNod: no, "--template xul" is a parameter to cfx init in my (outdated) fork; "templatedir" can be used with cfx run/xpi in baseline addon sdk ( addons.mozilla.org/en-US/developers/docs/sdk/1.0/dev-guide/… ), and my fork adds a templatedir property to package.json when generating a xul extension.Cathouse

© 2022 - 2024 — McMap. All rights reserved.