1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

firefox: allow separators in bookmarks (#7284)

Allow users to create separators in their Firefox bookmarks.

Co-authored-by: xaltsc <hey@xaltsc.dev>
This commit is contained in:
xaltsc 2025-06-16 22:51:11 +02:00 committed by GitHub
parent 1db3cb415d
commit 0edffd088e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 2 deletions

View file

@ -50,6 +50,8 @@ rec {
bookmarkType = types.addCheck bookmarkSubmodule (x: x ? "url"); bookmarkType = types.addCheck bookmarkSubmodule (x: x ? "url");
separatorType = types.enum [ "separator" ];
directoryType = directoryType =
types.submodule ( types.submodule (
{ name, ... }: { name, ... }:
@ -83,5 +85,9 @@ rec {
description = "directory submodule"; description = "directory submodule";
}; };
nodeType = types.either bookmarkType directoryType; nodeType = types.oneOf [
bookmarkType
directoryType
separatorType
];
} }

View file

@ -45,9 +45,16 @@ let
${allItemsToHTML (indentLevel + 1) directory.bookmarks} ${allItemsToHTML (indentLevel + 1) directory.bookmarks}
${indent indentLevel}</DL><p>''; ${indent indentLevel}</DL><p>'';
separatorToHTML = indentLevel: "${indent indentLevel}<HR>";
itemToHTMLOrRecurse = itemToHTMLOrRecurse =
indentLevel: item: indentLevel: item:
if item ? "url" then bookmarkToHTML indentLevel item else directoryToHTML indentLevel item; if item ? "url" then
bookmarkToHTML indentLevel item
else if item == "separator" then
separatorToHTML indentLevel
else
directoryToHTML indentLevel item;
allItemsToHTML = allItemsToHTML =
indentLevel: bookmarks: lib.concatStringsSep "\n" (map (itemToHTMLOrRecurse indentLevel) bookmarks); indentLevel: bookmarks: lib.concatStringsSep "\n" (map (itemToHTMLOrRecurse indentLevel) bookmarks);
@ -106,6 +113,7 @@ in
name = "kernel.org"; name = "kernel.org";
url = "https://www.kernel.org"; url = "https://www.kernel.org";
} }
"separator"
{ {
name = "Nix sites"; name = "Nix sites";
toolbar = true; toolbar = true;

View file

@ -38,6 +38,7 @@ in
name = "kernel.org"; name = "kernel.org";
url = "https://www.kernel.org"; url = "https://www.kernel.org";
} }
"separator"
{ {
name = "Nix sites"; name = "Nix sites";
bookmarks = [ bookmarks = [

View file

@ -11,6 +11,7 @@
<DT><A HREF="https://wiki.nixos.org/wiki/Home_Manager" ADD_DATE="1" LAST_MODIFIED="1">Home Manager</A> <DT><A HREF="https://wiki.nixos.org/wiki/Home_Manager" ADD_DATE="1" LAST_MODIFIED="1">Home Manager</A>
</DL><p> </DL><p>
<DT><A HREF="https://www.kernel.org" ADD_DATE="1" LAST_MODIFIED="1">kernel.org</A> <DT><A HREF="https://www.kernel.org" ADD_DATE="1" LAST_MODIFIED="1">kernel.org</A>
<HR>
<DT><H3 ADD_DATE="1" LAST_MODIFIED="1">Nix sites</H3> <DT><H3 ADD_DATE="1" LAST_MODIFIED="1">Nix sites</H3>
<DL><p> <DL><p>
<DT><A HREF="https://nixos.org/" ADD_DATE="1" LAST_MODIFIED="1">homepage</A> <DT><A HREF="https://nixos.org/" ADD_DATE="1" LAST_MODIFIED="1">homepage</A>