about summary refs log tree commit diff
path: root/modules/firefox
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-11-17 18:21:17 +0300
committerazahi <azat@bahawi.net>2024-11-17 18:21:17 +0300
commitfc2e6a3a6b568d5ae1004723ea54c123af7e9242 (patch)
tree5adf2a7741c6ee319833fe6079f9958961ef56b5 /modules/firefox
parent2024-11-10 (diff)
2024-11-17 HEAD master
Diffstat (limited to 'modules/firefox')
-rw-r--r--modules/firefox/addons.json3
-rw-r--r--modules/firefox/addons.nix33
-rw-r--r--modules/firefox/default.nix29
-rw-r--r--modules/firefox/userChrome.css140
-rw-r--r--modules/firefox/userContent.css7
5 files changed, 46 insertions, 166 deletions
diff --git a/modules/firefox/addons.json b/modules/firefox/addons.json
index 2a217c2..f189ed7 100644
--- a/modules/firefox/addons.json
+++ b/modules/firefox/addons.json
@@ -7,9 +7,6 @@
     "slug": "consent-o-matic"
   },
   {
-    "slug": "darkreader"
-  },
-  {
     "slug": "furiganaize"
   },
   {
diff --git a/modules/firefox/addons.nix b/modules/firefox/addons.nix
index ebe834a..6fac4df 100644
--- a/modules/firefox/addons.nix
+++ b/modules/firefox/addons.nix
@@ -52,27 +52,6 @@
       platforms = platforms.all;
     };
   };
-  "darkreader" = buildFirefoxXpiAddon {
-    pname = "darkreader";
-    version = "4.9.94";
-    addonId = "addon@darkreader.org";
-    url = "https://addons.mozilla.org/firefox/downloads/file/4359254/darkreader-4.9.94.xpi";
-    sha256 = "251c4e7d0a30c0cab006803600e59ab92dcc0c606429740d42677846d4c9ccd6";
-    meta = with lib; {
-      homepage = "https://darkreader.org/";
-      description = "Dark mode for every website. Take care of your eyes, use dark theme for night and daily browsing.";
-      license = licenses.mit;
-      mozPermissions = [
-        "alarms"
-        "contextMenus"
-        "storage"
-        "tabs"
-        "theme"
-        "<all_urls>"
-      ];
-      platforms = platforms.all;
-    };
-  };
   "furiganaize" = buildFirefoxXpiAddon {
     pname = "furiganaize";
     version = "0.7.2";
@@ -288,10 +267,10 @@
   };
   "ublock-origin" = buildFirefoxXpiAddon {
     pname = "ublock-origin";
-    version = "1.60.0";
+    version = "1.61.0";
     addonId = "uBlock0@raymondhill.net";
-    url = "https://addons.mozilla.org/firefox/downloads/file/4359936/ublock_origin-1.60.0.xpi";
-    sha256 = "e2cda9b2a1b0a7f6e5ef0da9f87f28df52f8560587ba2e51a3003121cfb81600";
+    url = "https://addons.mozilla.org/firefox/downloads/file/4382536/ublock_origin-1.61.0.xpi";
+    sha256 = "e6fd55b799a568c66c10892a8f22428e6773fe16d7466ce9dee2952f224b203d";
     meta = with lib; {
       homepage = "https://github.com/gorhill/uBlock#ublock-origin";
       description = "Finally, an efficient wide-spectrum content blocker. Easy on CPU and memory.";
@@ -348,10 +327,10 @@
   };
   "violentmonkey" = buildFirefoxXpiAddon {
     pname = "violentmonkey";
-    version = "2.26.0";
+    version = "2.28.0";
     addonId = "{aecec67f-0d10-4fa7-b7c7-609a2db280cf}";
-    url = "https://addons.mozilla.org/firefox/downloads/file/4362578/violentmonkey-2.26.0.xpi";
-    sha256 = "47b61fd463602a38bf67591ab94c60d3f1a02ad4f81b9a8a3de97d5461b2e12e";
+    url = "https://addons.mozilla.org/firefox/downloads/file/4379821/violentmonkey-2.28.0.xpi";
+    sha256 = "30bc3db14194a5197e4721d419123f3a02b9c6f3e94646724aa991137121bcba";
     meta = with lib; {
       homepage = "https://violentmonkey.github.io/";
       description = "Userscript support for browsers, open source.";
diff --git a/modules/firefox/default.nix b/modules/firefox/default.nix
index 51e464f..c207930 100644
--- a/modules/firefox/default.nix
+++ b/modules/firefox/default.nix
@@ -41,28 +41,6 @@ in
             mkCssWithRoot =
               css:
               mkMerge [
-                # https://github.com/tinted-theming/base24/blob/master/styling.md
-                (with config.colors.withHashtag; ''
-                  :root {
-                    --black: ${base01};
-                    --red: ${base08};
-                    --green: ${base0B};
-                    --yellow: ${base09};
-                    --blue: ${base0D};
-                    --magenta: ${base0E};
-                    --cyan: ${base0C};
-                    --white: ${base06};
-                    --bright-black: ${base02};
-                    --bright-red: ${base12};
-                    --bright-green: ${base14};
-                    --bright-yellow: ${base13};
-                    --bright-blue: ${base16};
-                    --bright-magenta: ${base17};
-                    --bright-cyan: ${base15};
-                    --bright-white: ${base07};
-                    --background: ${base00};
-                    --foreground: ${base05};
-                '')
                 (
                   let
                     mapFonts = concatMapStringsSep ", " (font: ''"${font}"'');
@@ -70,6 +48,7 @@ in
                   in
                   with config.fonts.fontconfig.defaultFonts;
                   ''
+                    :root {
                       --serif-font-family: ${mapFonts serif}, serif;
                       --serif-font-size: ${size};
                       --sans-serif-font-family: ${mapFonts sansSerif}, sans-serif;
@@ -124,7 +103,6 @@ in
               with addons;
               [
                 consent-o-matic
-                darkreader
                 furiganaize
                 languagetool
                 metamask
@@ -422,6 +400,10 @@ in
                 name = "Bookmarks Toolbar";
                 toolbar = true;
                 bookmarks = with config.nixfiles.modules; [
+                  {
+                    name = "XUL";
+                    url = "chrome://browser/content/browser.xhtml";
+                  }
                   (mkIf syncthing.enable {
                     name = "Syncthing";
                     url = "http://${config.services.syncthing.guiAddress}";
@@ -530,6 +512,7 @@ in
               "browser.tabs.warnOnClose" = false;
               "browser.tabs.warnOnCloseOtherTabs" = false;
               "browser.tabs.warnOnOpen" = false;
+              "browser.theme.dark-private-windows" = false;
               "browser.toolbars.bookmarks.visibility" = "newtab";
               "browser.translations.enable" = false;
               "browser.urlbar.decodeURLsOnCopy" = true;
diff --git a/modules/firefox/userChrome.css b/modules/firefox/userChrome.css
index 80d1f7a..aeb1c8f 100644
--- a/modules/firefox/userChrome.css
+++ b/modules/firefox/userChrome.css
@@ -1,23 +1,9 @@
 @-moz-document url(chrome://browser/content/browser.xhtml)
 {
-  /*
-   ***
-   * Tabbar
-   ***
-   */
-
-  /*
-   * Apply colours and fonts.
-   */
-  .tabbrowser-tab {
-    color: var(--background-alt) !important;
+  #urlbar {
     font-family: var(--sans-serif-font-family) !important;
     font-size: var(--sans-serif-font-size) !important;
   }
-  .tabbrowser-tab[visuallyselected="true"] {
-    background: var(--background) !important;
-    color: var(--foreground) !important;
-  }
 
   /*
    * Not sure why is this shit even exists...
@@ -34,32 +20,6 @@
   }
 
   /*
-   * Disable borders and margins.
-   */
-  #tabbrowser-tabs {
-    border-inline-start: 0 !important;
-    /* padding-inline-start: 0 !important; */
-    margin-inline-start: 0 !important;
-  }
-  #tabbrowser-tabs[haspinnedtabs]:not([positionpinnedtabs])
-    > #tabbrowser-arrowscrollbox
-    > .tabbrowser-tab[first-visible-unpinned-tab] {
-    margin-inline-start: none !important;
-  }
-  .tabbrowser-tab::after,
-  .tabbrowser-tab::before {
-    border: none !important;
-  }
-
-  /*
-   * Make tabs backgroundless.
-   */
-  /* .tab-background, */
-  /* .tab-line { */
-  /*   display: none !important; */
-  /* } */
-
-  /*
    * Stretch tabs to the max by default.
    */
   .tabbrowser-tab[fadein]:not([pinned="true"]) {
@@ -67,14 +27,6 @@
   }
 
   /*
-   * Fix favicon location.
-   */
-  .tab-icon-image {
-    margin-inline-end: 10px !important;
-    margin-top: 0px !important;
-  }
-
-  /*
    * "C-t" exists.
    */
   #tabs-newtab-button,
@@ -90,64 +42,13 @@
   }
 
   /*
-   ***
-   * Navbar & urlbar.
-   ***
-   */
-
-  /*
-   * Remove padding between urlbar and side elements.
+   * Remove padding between URL bar and side elements.
    */
   #customizableui-special-spring1,
   #customizableui-special-spring2 {
     display: none !important;
   }
 
-  #urlbar {
-    background: var(--background) !important;
-    color: var(--foreground) !important;
-    font-family: var(--sans-serif-font-family) !important;
-    font-size: var(--sans-serif-font-size) !important;
-    border-color: transparent !important;
-  }
-
-  /* #urlbar:not(:-moz-lwtheme):not([focused="true"]) > #urlbar-background, */
-  /* #searchbar:not(:-moz-lwtheme):not(:focus-within) { */
-  /*   border: none !important; */
-  /* } */
-
-  /* #urlbar *|*.textbox-input::-moz-placeholder { */
-  /*   color: transparent !important; */
-  /* } */
-
-  /* .urlbar-icon:hover:not([disabled]), */
-  /* .urlbar-icon-wrapper:hover:not([disabled]) { */
-  /*   background-color: var(--background-alt) !important; */
-  /* } */
-
-  /* #urlbar-background { */
-  /*   background: transparent !important; */
-  /* } */
-
-  /* .urlbarView-tags, */
-  /* .urlbarView-url, */
-  /* .urlbarView-title:not(:empty) ~ .urlbarView-action { */
-  /*   font-size: var(--sans-serif-font-size) !important; */
-  /* } */
-
-  .urlbarView-row[label="Firefox Suggest"] {
-    margin-block-start: 0 !important;
-  }
-  .urlbarView-row[label="Firefox Suggest"]::before {
-    display: none !important;
-  }
-
-  /*
-   ***
-   * Misc.
-   ***
-   */
-
   /*
    * Call indicator that some "designer" decided to make floating and impossible
    * to hide.
@@ -157,16 +58,41 @@
   }
 
   /*
-   * Disable some context menu entries.
-   */
-  #context-navigation {
+   * Context menu. Both for tabs and page.
+   */
+  #context-bookmarklink,
+  #context-inspect-a11y,
+  #context-navigation,
+  #context-pocket,
+  #context-print-selection,
+  #context-searchselect,
+  #context-selectall,
+  #context-sendimage,
+  #context-sendlinktodevice,
+  #context-sendpagetodevice,
+  #context-viewsource,
+  #context_bookmarkTab,
+  #context_moveTabOptions,
+  #context_selectAllTabs,
+  #context_sendTabToDevice,
+  menuseparator {
     display: none !important;
   }
 
   /*
-   * Remove dumb websites that Mozilla is forced to include.
+   * Unify margins for tab browser.
    */
-  .search-one-offs {
-    display: none !important;
+  #tabbrowser-tabs {
+    margin-inline-start: 0 !important;
+    border-inline-start: 0 !important;
+    padding-inline-start: calc(
+      var(--tab-overflow-pinned-tabs-width) + 2px
+    ) !important;
+    margin-inline-start: 0 !important;
+  }
+  #tabbrowser-tabs[haspinnedtabs]:not([positionpinnedtabs])[orient="horizontal"]
+    > #tabbrowser-arrowscrollbox
+    > .tabbrowser-tab:nth-child(1 of :not([pinned], [hidden])) {
+    margin-inline-start: 0 !important;
   }
 }
diff --git a/modules/firefox/userContent.css b/modules/firefox/userContent.css
index 96bb529..72382db 100644
--- a/modules/firefox/userContent.css
+++ b/modules/firefox/userContent.css
@@ -1,16 +1,11 @@
 @-moz-document media-document(all) {
   body {
     background-image: none !important;
-    background-color: var(--background) !important;
+    background-color: var(--background-color-box) !important;
   }
 }
 
 @-moz-document regexp("about:(blank|home|newtab|privatebrowsing|welcome)") {
-  html,
-  body {
-    background: var(--background) !important;
-  }
-
   body {
     display: none !important;
   }

Consider giving Nix/NixOS a try! <3