How do you pin a Firefox extensions / add-on to the Firefox Toolbar?

I want to remove any ambiguity about the word “pin” in the context of this post. This post is specifically seeking information about how you pin or stick an installed Firefox extension to the Firefox toolbar and ideally specify it’s position. This post is not about pinning a Firefox extension to a specific version number.

I have managed to successfully install Firefox extensions that I require using the following code snippet:

programs.firefox = {
  enable = true;
  policies = {
    ExtensionsSettings = {
      "*".installation_mode = "blocked";
      "ublock0@raymondhill.net" = {
         install_url = "https://addons.mozzila.org/firefox/downloads/latest/ublock-origin/latest.xpi";
         installation_mode = "force_installer";
       };
     };
   };
};

This declaratively installs the extensions into Firefox, however it does not automatically pin the extension to the Firefox toolbar. This needs to be done manually.

Does anyone have an idea or suggestions about how I can declaratively specify that I want to pin the installed extension to the Firefox toolbar and ideally specify the sequence of how the installed extensions are to be displayed when pinned to the toolbar?

Any ideas would be appreciated.

I think the UI state is in a big json blob in about:config which you could only enforce as a whole in nix.

Oh, so it’s browser.uiCustomization.state.

@vccs, A quick look at browser.uiCustomization.state looks interesting. I’m not sure if it’s the default layout or the current layout. I’ll investigate further and report back.

@Sandro, thank you for the pointer. If browser.uiCustomization.state turns out to be workable, it won’t be necessary to manage the entire json blob, just set this key.

Thank you both for the ideas.

1 Like

default_area from the policy template documentation under ExtensionSettings, note this is for Firefox 113 and above only though!

1 Like