From a9c96b8a06b14eb0a9691ef8191af77767b90e03 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Fri, 28 Jun 2024 08:40:56 +0100 Subject: [PATCH] Add NYXT bookmark converter, renable NYXT browser Add converter to read bookmarks.json and convert to lisp format expected by NYXT Enable NYXT again (as well as firefox) now that bookmarks are available Swap accent and alt accent (with each other) --- flake.nix | 4 +- programs/browser/bookmarks.lisp | 122 -------------------------------- programs/browser/default.nix | 7 +- programs/browser/nyxt.nix | 23 +++++- 4 files changed, 30 insertions(+), 126 deletions(-) delete mode 100644 programs/browser/bookmarks.lisp diff --git a/flake.nix b/flake.nix index cd8100b..4a6a3ca 100644 --- a/flake.nix +++ b/flake.nix @@ -43,8 +43,8 @@ }: rec { inherit hostname; inherit (plasma-manager.packages.${system}) rc2nix; - accentColourName = "base0D"; - altAccentColourName = "base0C"; + accentColourName = "base0C"; + altAccentColourName = "base0D"; iosevkaCustom = { packages = iosevka-custom.outputs.packages.${system}; names = iosevka-custom.outputs.names; diff --git a/programs/browser/bookmarks.lisp b/programs/browser/bookmarks.lisp deleted file mode 100644 index 2296cb1..0000000 --- a/programs/browser/bookmarks.lisp +++ /dev/null @@ -1,122 +0,0 @@ -( - ;; Personal - - ;; Messaging - ( :url "https://web.whatsapp.com/" - :title "WhatApp Web" - :tags ("personal" "messaging")) - ( :url "https://discord.com/app" - :title "Discord" - :tags ("personal" "messaging")) - ;; Server - ( :url "https://xenia.me.uk" - :title "Home Page" - :tags ("personal" "server")) - ( :url "https://git.xenia.me.uk" - :title "Forgejo" - :tags ("personal" "server" "dev" "git")) - ( :url "https://blog.xenia.me.uk" - :title "Blog" - :tags ("personal" "server")) - ;; Dev - ( :url "https://github.com" - :title "GitHub" - :tags ("personal" "dev" "git")) - ;; EV - ( :url "https://abetterrouteplanner.com/" - :title "ABRP - A Better Route Planner" - :tags ("personal" "ev" "map")) - ;; Documentation - ( :url "https://nixos-and-flakes.thiscute.world/" - :title "NixOS and Flakes" - :tags ("personal" "documentation")) - ( :url "https://nix-community.github.io/home-manager/options.xhtml" - :title "Home Manager Configuration Options" - :tags ("personal" "documentation")) - ( :url "https://mipmip.github.io/home-manager-option-search/" - :title "Home Manager Option Search" - :tags ("personal" "documentation")) - ;; Awesome Repos - ( :url "https://github.com/emacs-tw/awesome-emacs" - :title "Awesome Emacs" - :tags ("personal" "awesome" "git")) - ;; Miscellaneous - ( :url "https://www.colorhexa.com/" - :title "Colour Encyclopedia" - :tags ("personal" "miscellaneous")) - - ;; Work - - ( :url "https://nucleus.ukaea.uk/" - :title "Nucleus" - :tags ("work")) - ( :url "https://marval.service.ukaea.uk/MSMSelfService/Index.aspx" - :title "Marval Helpdesk" - :tags ("work")) - ( :url "https://ubw.unit4cloud.com/uk_aea_prod_web/Login/Login.aspx" - :title "Unit4 Business World" - :tags ("work")) - ;; Dev - ( :url "https://git.ccfe.ac.uk/" - :title "GitLab (CCFE)" - :tags ("work" "dev" "git")) - ;; JET - ( :url "http://w3.jet.uk/" - :title "JET Homepage" - :tags ("work" "jet")) - ( :url "https://users.euro-fusion.org/pages/physics-summary/LatestSession.php" - :title "JET Physics Summary" - :tags ("work" "jet")) - ( :url "https://www.jspo.jet.uk/pages/operations/jpecreports_2023.html" - :title "JSPO JPEC Reports" - :tags ("work" "jet")) - ( :url "https://dvcm.jetdata.eu/" - :title "DVCM Homepage" - :tags ("work" "jet")) - ;; JET Data Services - ( :url "https://data.jet.uk/" - :title "JET Data Services" - :tags ("work" "jet" "data")) - ( :url "https://data.jet.uk/ppf/browse/ppfquery" - :title "PPF Query" - :tags ("work" "jet" "data")) - ( :url "https://data.jet.uk/reqco/myrequests" - :title "ReqCo" - :tags ("work" "jet" "data")) - ;; MAST-U - ( :url "https://users.mastu.ukaea.uk/home" - :title "MAST-U Users Page" - :tags ("work" "mast-u")) - ( :url "https://intranet.ccfe.ac.uk/mastu-handbook" - :title "MAST-U Diagnostic Handbook" - :tags ("work" "mast-u")) - ;; OpenWiki - ( :url "https://wiki.jetdata.eu/open/index.php?title=Main_Page" - :title "OpenWiki Homepage" - :tags ("work" "openwiki")) - ( :url "https://wiki.jetdata.eu/open/index.php?title=Diagnostic_Coordinator_Wiki" - :title "Diagnostic Coordinator Wiki" - :tags ("work" "openwiki")) - ( :url "https://wiki.jetdata.eu/open/index.php?title=Spectroscopy_Group:index" - :title "Spectroscopy Group Wiki" - :tags ("work" "openwiki")) - ( :url "https://wiki.jetdata.eu/open/index.php?title=CXS:Topic3" - :title "KS5 Wiki" - :tags ("work" "openwiki")) - ( :url "https://wiki.jetdata.eu/open/index.php?title=KT3_Journals" - :title "KT3 Wiki" - :tags ("work" "openwiki")) - ;; Office - ( :url "https://outlook.office.com/calendar/view/workweek" - :title "Outlook Calendar" - :tags ("work" "microsoft" "office")) - ( :url "https://teams.microsoft.com/v2" - :title "Microsoft Teams" - :tags ("work" "microsoft" "office")) - ( :url "https://ukaeauk-my.sharepoint.com/personal/evie_litherland-smith_ukaea_uk/" - :title "OneDrive" - :tags ("work" "microsoft" "office")) - ( :url "https://ukaeauk.sharepoint.com/" - :title "Sharepoint" - :tags ("work" "microsoft" "office")) - ) diff --git a/programs/browser/default.nix b/programs/browser/default.nix index 7fe62d1..5ab35c7 100644 --- a/programs/browser/default.nix +++ b/programs/browser/default.nix @@ -1 +1,6 @@ -{...}: {imports = [./firefox.nix];} +{...}: { + imports = [ + ./nyxt.nix + ./firefox.nix + ]; +} diff --git a/programs/browser/nyxt.nix b/programs/browser/nyxt.nix index 0aa7266..fa1c6f1 100644 --- a/programs/browser/nyxt.nix +++ b/programs/browser/nyxt.nix @@ -40,6 +40,27 @@ :on-codeblock-color "${sc.base05}")))) ''; }; - # dataFile."nyxt/bookmarks.lisp".source = ./bookmarks.lisp; + dataFile."nyxt/bookmarks.lisp".text = let + # Make a string of lisp-style list of strings, from nix-style + # list + convertTags = tags: "(" + (builtins.foldl' (x: y: x + " \"" + y + "\"") "" tags) + " )"; + # Take bookmarks as returned from JSON file and convert to NYXT + # expected format + convertBookmark = { + name, + tags, + url, + }: "(:url \"${url}\" :title \"${name}\" :tags ${convertTags tags})\n"; + in ( + # Fold all entries in bookmarks.json into single string of NYXT + # format bookmarks, each entry on a new line and with 2 space + # indentation, just for visual clarity if reading the outputted + # file + "(\n" + + (builtins.foldl' + (x: y: x + " " + convertBookmark y) "" + (builtins.fromJSON (builtins.readFile ./bookmarks.json))) + + ")" + ); }; }