From d6cd3cab18708ad39d138a16d9d68a19f1616546 Mon Sep 17 00:00:00 2001
From: matt1432 <matt@nelim.org>
Date: Tue, 10 Oct 2023 13:15:05 -0400
Subject: [PATCH] feat(firefox): add custom settings and css

---
 nixos/home/firefox/custom.css | 35 +++++++++++++++++++++++++++++++++++
 nixos/home/firefox/main.nix   | 13 ++++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 nixos/home/firefox/custom.css

diff --git a/nixos/home/firefox/custom.css b/nixos/home/firefox/custom.css
new file mode 100644
index 00000000..6d6e84e6
--- /dev/null
+++ b/nixos/home/firefox/custom.css
@@ -0,0 +1,35 @@
+.browser-toolbar > * #alltabs-button,
+#appMenu-fxa-status2,
+#appMenu-fxa-separator {
+  display: none !important;
+}
+
+#unified-extensions-button {
+  display: flex;
+  left: calc(100vw - var(--uc-window-control-width) - 13px) !important;
+  top: var(--windowed-top-padding, -0.5px);
+  z-index: 3 !important;
+}
+
+#appMenu-popup {
+  position: fixed !important;
+  top: 0px !important;
+  left: 0px !important;
+  margin: 0 !important;
+}
+
+#appMenu-popup panelview {
+  border-width: 2px 6px !important;
+  border-radius: 5% 0 0 5% !important;
+  border-image: var(--panel-separator-zap-gradient4) 1 !important;
+}
+
+#unified-extensions-panel panelview {
+  border-width: 0 !important;
+  border-radius: 0px !important;
+}
+
+slot {
+  margin: 0 !important;
+  border-radius: 5% 0 0 5% !important;
+}
diff --git a/nixos/home/firefox/main.nix b/nixos/home/firefox/main.nix
index af5d8692..ca09511b 100644
--- a/nixos/home/firefox/main.nix
+++ b/nixos/home/firefox/main.nix
@@ -6,7 +6,9 @@
 in
 {
   home.file = {
-    ".mozilla/firefox/matt/chrome".source = "${firefox-gx}/chrome";
+    ".mozilla/firefox/matt/chrome/components".source = "${firefox-gx}/chrome/components";
+    ".mozilla/firefox/matt/chrome/icons".source      = "${firefox-gx}/chrome/icons";
+    ".mozilla/firefox/matt/chrome/images".source     = "${firefox-gx}/chrome/images";
   };
 
   programs.firefox = {
@@ -15,14 +17,23 @@ in
       isDefault = true;
       id = 0;
 
+      userChrome = ''
+        ${builtins.readFile "${firefox-gx}/chrome/userChrome.css"}
+        ${builtins.readFile ./custom.css}
+      '';
+      userContent = builtins.readFile "${firefox-gx}/chrome/userContent.css";
       extraConfig = builtins.readFile "${firefox-gx}/user.js";
+
       settings = {
         # Open previous windows and tabs
         "browser.startup.page" = 3;
 
         # Prefs
+        "layout.css.devPixelsPerPx" = 1.15;
+        "browser.tabs.firefox-view" = false;
         "browser.search.widget.inNavBar" = true;
         "browser.toolbars.bookmarks.visibility" = "always";
+        "browser.toolbars.bookmarks.showInPrivateBrowsing" = true;
 
         # remove telemetry
         "datareporting.policy.dataSubmissionEnabled" = false;