about summary refs log tree commit diff
path: root/modules/nixos/firefox
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-03 14:20:46 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-03 14:20:46 +0300
commit53376afaf1ee4eb5d8e0ffb1ace1ee8f48c71235 (patch)
tree8661c81d8cf75b19a98d9e5db2f439734eb847dc /modules/nixos/firefox
parent2024-03-02 (diff)
2024-03-03
Diffstat (limited to 'modules/nixos/firefox')
-rw-r--r--modules/nixos/firefox/default.nix31
-rw-r--r--modules/nixos/firefox/userChrome.css106
2 files changed, 54 insertions, 83 deletions
diff --git a/modules/nixos/firefox/default.nix b/modules/nixos/firefox/default.nix
index d192ae1..6d1b31b 100644
--- a/modules/nixos/firefox/default.nix
+++ b/modules/nixos/firefox/default.nix
@@ -37,6 +37,7 @@ in {
         profiles.default = let
           mkCssWithRoot = css:
             mkMerge [
+              # https://github.com/tinted-theming/base24/blob/master/styling.md
               (with config.colors.withHashtag; ''
                 :root {
                   --black: ${base01};
@@ -56,17 +57,23 @@ in {
                   --bright-cyan: ${base15};
                   --bright-white: ${base07};
                   --background: ${base00};
-                  --foreground: ${base02};
-              '')
-              (with config.stylix.fonts; ''
-                  --sans-serif-font-family: "${sansSerif.name}", sans-serif;
-                  --sans-serif-font-size: ${toString sizes.applications};
-                  --serif-font-family: "${serif.name}", serif;
-                  --serif-font-size: ${toString sizes.applications};
-                  --monospace-font-family: "${monospace.name}", monospace;
-                  --monospace-font-size: ${toString sizes.applications};
-                }
+                  --foreground: ${base05};
               '')
+              (
+                let
+                  mapFonts = concatMapStringsSep ", " (font: ''"${font}"'');
+                  size = toString config.stylix.fonts.sizes.applications;
+                in
+                  with config.fonts.fontconfig.defaultFonts; ''
+                      --serif-font-family: ${mapFonts serif}, serif;
+                      --serif-font-size: ${size};
+                      --sans-serif-font-family: ${mapFonts sansSerif}, sans-serif;
+                      --sans-serif-font-size: ${size};
+                      --monospace-font-family: ${mapFonts monospace}, monospace;
+                      --monospace-font-size: ${size};
+                    }
+                  ''
+              )
               (builtins.readFile css)
             ];
         in {
@@ -565,6 +572,7 @@ in {
             "browser.disableResetPrompt" = true;
             "browser.download.autohideButton" = false;
             "browser.newtabpage.introShown" = true;
+            "browser.newtabpage.pinned" = "";
             "browser.onboarding.enabled" = false;
             "browser.open.lastDir" = config.my.home;
             "browser.protections_panel.infoMessage.seen" = true;
@@ -575,7 +583,8 @@ in {
             "browser.tabs.closeWindowWithLastTab" = true;
             "browser.tabs.firefox-view" = false;
             "browser.tabs.firefox-view-next" = false;
-            "browser.tabs.inTitlebar" = 1;
+            "browser.tabs.inTitlebar" = 0;
+            "browser.tabs.tabmanager.enabled" = false;
             "browser.tabs.warnOnClose" = false;
             "browser.tabs.warnOnCloseOtherTabs" = false;
             "browser.tabs.warnOnOpen" = false;
diff --git a/modules/nixos/firefox/userChrome.css b/modules/nixos/firefox/userChrome.css
index 4fd1d3f..80d1f7a 100644
--- a/modules/nixos/firefox/userChrome.css
+++ b/modules/nixos/firefox/userChrome.css
@@ -1,33 +1,5 @@
-@-moz-document url(chrome://browser/content/browser.xul), url(chrome://browser/content/browser.xhtml)
+@-moz-document url(chrome://browser/content/browser.xhtml)
 {
-  /* :root { */
-  /*   /\* */
-  /*    * Helper colours. */
-  /*    *\/ */
-  /*   --background: var(--black) !important; */
-  /*   --foreground: var(--white) !important; */
-  /*   --background-alt: var(--bright-black) !important; */
-  /*   --foreground-alt: var(--bright-white) !important; */
-
-  /*   /\* */
-  /*    * Various root values that can be redefined. */
-  /*    *\/ */
-  /*   --arrowpanel-border-radius: 0 !important; */
-  /*   --autocomplete-popup-highlight-background: var(--background) !important; */
-  /*   --autocomplete-popup-highlight-color: var(--foreground) !important; */
-  /*   --backbutton-background: transparent !important; */
-  /*   --backbutton-border-color: transparent !important; */
-  /*   --tab-block-margin: 0 !important; */
-  /*   --tab-border-radius: 0 !important; */
-  /*   --tabs-border-color: transparent !important; */
-  /*   --tabs-top-border-width: 0 !important; */
-  /*   --toolbar-field-focus-border-color: var(--background) !important; */
-  /*   --toolbar-non-lwt-bgcolor: var(--background) !important; */
-  /*   --toolbar-non-lwt-bgimage: none !important; */
-  /*   --toolbar-non-lwt-textcolor: var(--foreground) !important; */
-  /*   --toolbarbutton-border-radius: 0 !important; */
-  /* } */
-
   /*
    ***
    * Tabbar
@@ -37,15 +9,15 @@
   /*
    * Apply colours and fonts.
    */
-  /* .tabbrowser-tab { */
-  /*   color: var(--background-alt) !important; */
-  /*   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; */
-  /* } */
+  .tabbrowser-tab {
+    color: var(--background-alt) !important;
+    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...
@@ -55,6 +27,13 @@
   }
 
   /*
+   * Disable the Firefox View button.
+   */
+  #firefox-view-button {
+    display: none !important;
+  }
+
+  /*
    * Disable borders and margins.
    */
   #tabbrowser-tabs {
@@ -90,18 +69,18 @@
   /*
    * Fix favicon location.
    */
-  /* .tab-icon-image { */
-  /*   margin-inline-end: 10px !important; */
-  /*   margin-top: 0px !important; */
-  /* } */
+  .tab-icon-image {
+    margin-inline-end: 10px !important;
+    margin-top: 0px !important;
+  }
 
   /*
    * "C-t" exists.
    */
-  /* #tabs-newtab-button, */
-  /* #TabsToolbar #new-tab-button { */
-  /*   display: none !important; */
-  /* } */
+  #tabs-newtab-button,
+  #TabsToolbar #new-tab-button {
+    display: none !important;
+  }
 
   /*
    * "C-w" exists.
@@ -117,16 +96,6 @@
    */
 
   /*
-   * Remove useless buttons.
-   */
-  /* #forward-button, */
-  /* #back-button, */
-  /* #reload-button, */
-  /* #stop-button { */
-  /*     display: none !important; */
-  /* } */
-
-  /*
    * Remove padding between urlbar and side elements.
    */
   #customizableui-special-spring1,
@@ -134,13 +103,13 @@
     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 {
+    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) { */
@@ -180,8 +149,8 @@
    */
 
   /*
-   * Call indicator that some "designer" decided to make floating and
-   * impossible to hide.
+   * Call indicator that some "designer" decided to make floating and impossible
+   * to hide.
    */
   #webrtcIndicator {
     display: none !important;
@@ -195,13 +164,6 @@
   }
 
   /*
-   * Disable all animations.
-   */
-  /* * { */
-  /*     transition: none !important; */
-  /* } */
-
-  /*
    * Remove dumb websites that Mozilla is forced to include.
    */
   .search-one-offs {

Consider giving Nix/NixOS a try! <3