From ae6d5466bf3ee61f5565f1631a787a7eda68c99d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Na=C3=AFm=20Favier?=
Date: Thu, 4 May 2023 16:58:13 +0200
Subject: [PATCH] firefox: support bookmark tags (#3942)
---
modules/programs/firefox.nix | 11 +++++++++++
.../firefox/profile-settings-expected-bookmarks.html | 4 ++--
tests/modules/programs/firefox/profile-settings.nix | 2 ++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix
index 65671737..91ce2c30 100644
--- a/modules/programs/firefox.nix
+++ b/modules/programs/firefox.nix
@@ -71,6 +71,9 @@ let
}" ADD_DATE="0" LAST_MODIFIED="0"${
lib.optionalString (bookmark.keyword != null)
" SHORTCUTURL=\"${escapeXML bookmark.keyword}\""
+ }${
+ lib.optionalString (bookmark.tags != [ ])
+ " TAGS=\"${escapeXML (concatStringsSep "," bookmark.tags)}\""
}>${escapeXML bookmark.name}'';
directoryToHTML = indentLevel: directory: ''
@@ -251,6 +254,12 @@ in {
description = "Bookmark name.";
};
+ tags = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ description = "Bookmark tags.";
+ };
+
keyword = mkOption {
type = types.nullOr types.str;
default = null;
@@ -300,6 +309,7 @@ in {
[
{
name = "wikipedia";
+ tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
@@ -317,6 +327,7 @@ in {
}
{
name = "wiki";
+ tags = [ "wiki" "nix" ];
url = "https://nixos.wiki/";
}
];
diff --git a/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html b/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html
index d60e88ff..c65cb1b1 100644
--- a/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html
+++ b/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html
@@ -10,12 +10,12 @@
- Home Manager
- wikipedia
+ wikipedia
kernel.org
Nix sites
- homepage
-
- wiki
+
- wiki
Nix sites
- homepage
diff --git a/tests/modules/programs/firefox/profile-settings.nix b/tests/modules/programs/firefox/profile-settings.nix
index 3b5d6cc8..6cb1a0cb 100644
--- a/tests/modules/programs/firefox/profile-settings.nix
+++ b/tests/modules/programs/firefox/profile-settings.nix
@@ -31,6 +31,7 @@ lib.mkIf config.test.enableBig {
}
{
name = "wikipedia";
+ tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
@@ -47,6 +48,7 @@ lib.mkIf config.test.enableBig {
}
{
name = "wiki";
+ tags = [ "wiki" "nix" ];
url = "https://nixos.wiki/";
}
{