From d86c189158cb345e351190e362672a8485a52117 Mon Sep 17 00:00:00 2001 From: Ryan Horiguchi Date: Fri, 22 Jul 2022 15:32:45 +0200 Subject: [PATCH] firefox: support showing bookmarks on toolbar --- modules/programs/firefox.nix | 13 ++++++++++++- .../profile-settings-expected-bookmarks.html | 4 ++++ tests/modules/programs/firefox/profile-settings.nix | 7 +++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 2e1b335c0..39f1e9802 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -71,7 +71,12 @@ let }>${escapeXML bookmark.name}''; directoryToHTML = indentLevel: directory: '' - ${indent indentLevel}

${escapeXML directory.name}

+ ${indent indentLevel}
${ + if directory.toolbar then + ''

Bookmarks Toolbar'' + else + "

${escapeXML directory.name}" + }

${indent indentLevel}

${allItemsToHTML (indentLevel + 1) directory.bookmarks} ${indent indentLevel}

''; @@ -287,6 +292,12 @@ in { default = [ ]; description = "Bookmarks within directory."; }; + + toolbar = mkOption { + type = types.bool; + default = false; + description = "If directory should be shown in toolbar."; + }; }; }) // { description = "directory submodule"; diff --git a/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html b/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html index 4ba0bc600..2907a66cf 100644 --- a/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html +++ b/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html @@ -6,6 +6,10 @@ Bookmarks

Bookmarks Menu

+

Bookmarks Toolbar

+

+

Home Manager +

wikipedia
kernel.org

Nix sites

diff --git a/tests/modules/programs/firefox/profile-settings.nix b/tests/modules/programs/firefox/profile-settings.nix index e29221dac..fc8f4e71e 100644 --- a/tests/modules/programs/firefox/profile-settings.nix +++ b/tests/modules/programs/firefox/profile-settings.nix @@ -16,6 +16,13 @@ lib.mkIf config.test.enableBig { id = 2; settings = { "general.smoothScroll" = false; }; bookmarks = [ + { + toolbar = true; + bookmarks = [{ + name = "Home Manager"; + url = "https://nixos.wiki/wiki/Home_Manager"; + }]; + } { name = "wikipedia"; keyword = "wiki";