firefox: add bookmarks support

Generate bookmarks html file and hook it up in user.js.
This commit is contained in:
Emil Karlson 2021-09-29 09:39:17 +03:00 committed by Robert Helgesson
parent 095f3e32ae
commit e0a87d75e9
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 131 additions and 8 deletions

View file

@ -0,0 +1,8 @@
// Generated by Home Manager.
user_pref("browser.bookmarks.file", "/nix/store/00000000000000000000000000000000-firefox-bookmarks.html");
user_pref("browser.places.importBookmarksHTML", true);
user_pref("general.smoothScroll", false);

View file

@ -0,0 +1,12 @@
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks Menu</H1>
<DL><p>
<DT><A HREF="https://www.kernel.org" ADD_DATE="0" LAST_MODIFIED="0">kernel.org</A>
<DT><A HREF="https://en.wikipedia.org/wiki/Special:Search?search=%s&amp;go=Go" ADD_DATE="0" LAST_MODIFIED="0" SHORTCUTURL="wiki">wikipedia</A>
</p></DL>

View file

@ -12,6 +12,19 @@ with lib;
id = 1;
settings = { "general.smoothScroll" = false; };
};
profiles.bookmarks = {
id = 2;
settings = { "general.smoothScroll" = false; };
bookmarks = {
wikipedia = {
keyword = "wiki";
url =
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
};
"kernel.org" = { url = "https://www.kernel.org"; };
};
};
};
nixpkgs.overlays = [
@ -39,6 +52,21 @@ with lib;
assertFileContent \
home-files/.mozilla/firefox/test/user.js \
${./profile-settings-expected-user.js}
bookmarksUserJs=$(normalizeStorePaths \
home-files/.mozilla/firefox/bookmarks/user.js)
assertFileContent \
$bookmarksUserJs \
${./profile-settings-expected-bookmarks-user.js}
bookmarksFile="$(sed -n \
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
$TESTED/home-files/.mozilla/firefox/bookmarks/user.js)"
assertFileContent \
$bookmarksFile \
${./profile-settings-expected-bookmarks.html}
'';
};
}