mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36: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:
parent
1db3cb415d
commit
0edffd088e
4 changed files with 18 additions and 2 deletions
|
|
@ -50,6 +50,8 @@ rec {
|
|||
|
||||
bookmarkType = types.addCheck bookmarkSubmodule (x: x ? "url");
|
||||
|
||||
separatorType = types.enum [ "separator" ];
|
||||
|
||||
directoryType =
|
||||
types.submodule (
|
||||
{ name, ... }:
|
||||
|
|
@ -83,5 +85,9 @@ rec {
|
|||
description = "directory submodule";
|
||||
};
|
||||
|
||||
nodeType = types.either bookmarkType directoryType;
|
||||
nodeType = types.oneOf [
|
||||
bookmarkType
|
||||
directoryType
|
||||
separatorType
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,16 @@ let
|
|||
${allItemsToHTML (indentLevel + 1) directory.bookmarks}
|
||||
${indent indentLevel}</DL><p>'';
|
||||
|
||||
separatorToHTML = indentLevel: "${indent indentLevel}<HR>";
|
||||
|
||||
itemToHTMLOrRecurse =
|
||||
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 =
|
||||
indentLevel: bookmarks: lib.concatStringsSep "\n" (map (itemToHTMLOrRecurse indentLevel) bookmarks);
|
||||
|
|
@ -106,6 +113,7 @@ in
|
|||
name = "kernel.org";
|
||||
url = "https://www.kernel.org";
|
||||
}
|
||||
"separator"
|
||||
{
|
||||
name = "Nix sites";
|
||||
toolbar = true;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ in
|
|||
name = "kernel.org";
|
||||
url = "https://www.kernel.org";
|
||||
}
|
||||
"separator"
|
||||
{
|
||||
name = "Nix sites";
|
||||
bookmarks = [
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<DT><A HREF="https://wiki.nixos.org/wiki/Home_Manager" ADD_DATE="1" LAST_MODIFIED="1">Home Manager</A>
|
||||
</DL><p>
|
||||
<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>
|
||||
<DL><p>
|
||||
<DT><A HREF="https://nixos.org/" ADD_DATE="1" LAST_MODIFIED="1">homepage</A>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue