this post was submitted on 16 May 2024
10 points (100.0% liked)

Nix / NixOS

1725 readers
2 users here now

Main links

Videos

founded 1 year ago
MODERATORS
 

Hi,

I want to sort my bookmarks in Firefox with home-manager into folders, but fail.

Simple example:

firefox = {
      profiles."user" = {
        bookmarks = [
          {
            name = "Nix";
            toolbar = true;
            bookmarks = [
              {
                name = "NixOS Search";
                url = "https://search.nixos.org/packages";
              }
              {
                name = "NixOS Options";
                url = "https://nixos.org/manual/nixos/unstable/options";
              }
              {
                name = "Home-Manager Options";
                url = "https://nix-community.github.io/home-manager/options.xhtml";
              }
              {
                name = "Home-Manager Options Search";
                url = "https://home-manager-options.extranix.com/";
              }
            ];
          }
        ];
      };

My assumption was that I get a folder "Nix" in the bookmarks toolbar that contains the four bookmarks. But instead the four bookmarks are added to the toolbar side-by-side without being in a folder.

How can I achieve that?

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 5 months ago* (last edited 5 months ago) (1 children)

Make this the toolbar directory. Note, this does not mean that this directory will be added to the toolbar, this directory is the toolbar.

https://github.com/nix-community/home-manager/blob/master/modules%2Fprograms%2Ffirefox.nix#L425-L427

If you open the bookmarks utility in firefox, does it show as a folder as expected? I think maybe toolbar should be false if you expect to see your folder on the toolbar

[–] secana 1 points 5 months ago (1 children)

Thanks for the reply. When I disable the toolbar, the bookmarks are correctly placed in a folder but the folder is not visible in the toolbar anymore. So I can either have the bookmarks separately in the toolbar, or in a folder but not in the toolbar. The combination of both seems to be only possible if I move the bookmarks by hand in the UI :/

[–] [email protected] 1 points 5 months ago (1 children)
firefox = {
      profiles."user" = {
        bookmarks = [
          {
            name = "Toolbar folder";
            toolbar = true;
            bookmarks = [
               {
               name = "nix folder";
               toolbar = false;
               bookmarks = [
                  {
                    name = "NixOS Search";
                    url = "https://search.nixos.org/packages";
                  }
              

On phone so testing or reading source is a bit tough, but maybe nesting folders like the above work?

[–] secana 1 points 5 months ago

That worked! Thank you! The trick is really to embed the bookmarks into each other :)