summaryrefslogtreecommitdiff
path: root/nix_archive/nix/programs/firefox.nix
blob: dc16467829183038af5444d0b5e89b7956ba0a0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{ config, pkgs, ... }:
let
  colo = config.local.scheme;
in {
  environment.systemPackages = with pkgs; [
    firefox
  ];
  environment.sessionVariables = {
    BROWSER = "firefox";
  };
  services.psd.enable = true;
  home-manager.users.andrew = {
    home.file."user-overrides.js" = {
      target = ".mozilla/firefox/default/user-overrides.js";
      source = ../../../files/firefox/user-overrides.js;
    };
    home.file."firefox-gnome-theme" = {
      target = ".mozilla/firefox/default/chrome/firefox-gnome-theme";
      source = (pkgs.fetchFromGitHub {
        owner = "rafaelmardojai";
        repo = "firefox-gnome-theme";
        rev = "66b7c635763d8e6eb86bd766de5a1e1fbfcc1047";
        hash = "sha256-OkFLrD3pFR952TrjQi1+Vdj604KLcMnkpa7lkW7XskI=";
      });
    };
    home.file."customChrome.css" = {
      target = ".mozilla/firefox/default/chrome/customChrome.css";
      source = pkgs.writeText "customChrome.css" ''
        @namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

        @media (prefers-color-scheme: ${colo.lightness}) {
          :root {
            /* Accent */
            --gnome-accent-bg: #${colo.color3};
            --gnome-accent: #${colo.color4};

            --gnome-toolbar-star-button: #${colo.color4};

            /* Window */
            --gnome-window-background: #${colo.background};
            --gnome-window-color: #${colo.foreground};
            --gnome-view-background: #${colo.background};
            --gnome-sidebar-background: #${colo.color5};
            --gnome-secondary-sidebar-background: #${colo.color4};

            /* Card */
            --gnome-card-background: #${colo.background};
            --gnome-card-shade-color: #${colo.color4};

            /* Menu */
            --gnome-menu-background: #${colo.background};

            /* Header bar */
            --gnome-headerbar-background: #${colo.background};
            --gnome-headerbar-shade-color: #${colo.background};

            /* Toolbars */
            --gnome-toolbar-icon-fill: #${colo.foreground};

            /* Tabs */
            --gnome-tabbar-tab-hover-background: #${colo.color5};
            --gnome-tabbar-tab-active-background: #${colo.color4};
            --gnome-tabbar-tab-active-background-contrast: #${colo.color4};
            --gnome-tabbar-tab-active-hover-background: #${colo.color5};

            --gnome-tabbar-identity-color-green: var(--gnome-palette-green-1);
            --gnome-tabbar-identity-color-yellow: var(--gnome-palette-yellow-2);
            --gnome-tabbar-identity-color-orange: var(--gnome-palette-orange-3);
            --gnome-tabbar-identity-color-red: var(--gnome-palette-red-1);
            --gnome-tabbar-identity-color-purple: var(--gnome-palette-purple-1);

            /* Text color for Firefox Logo in new private tab */
            --gnome-private-wordmark: #${colo.background};
            /* New private tab background */
            --gnome-private-in-content-page-background: #${colo.background};
            /* Private browsing info box */
            --gnome-private-text-primary-color: #${colo.background};
          }

          /* Backdrop colors */
          :root:-moz-window-inactive {
            --gnome-tabbar-tab-hover-background: #${colo.background};
            --gnome-tabbar-tab-active-background: #${colo.background};
          }

          /* Private colors */
          :root[privatebrowsingmode="temporary"] {
            --gnome-accent-fg: #${colo.color4};
            /* Headerbar */
            --gnome-headerbar-background: #${colo.color5} !important;
            /* Tabs */
            --gnome-tabbar-tab-hover-background: #${colo.color5};
            --gnome-tabbar-tab-active-background: #${colo.background};
            --gnome-tabbar-tab-active-background-contrast: #${colo.background};
            --gnome-tabbar-tab-active-hover-background: #${colo.color5};
          }

          /* Private and backdrop colors */
          :root[privatebrowsingmode="temporary"]:-moz-window-inactive {
            --gnome-headerbar-background: #${colo.color5} !important;
            --gnome-tabbar-tab-hover-background: #${colo.color5};
            --gnome-tabbar-tab-active-background: #${colo.color5};
          }
        }
      '';
    };
    home.sessionVariables = {
      MOZ_WEBRENDER = "1";
      MOZ_USE_XINPUT2 = "1";
      MOZ_ENABLE_WAYLAND = "1";
    };
    programs.firefox = {
      enable = true;
      profiles.default = {
        extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [
          ublock-origin
          youtube-recommended-videos
        ];
        userChrome = ''
          @import "firefox-gnome-theme/userChrome.css";
          @import "customChrome.css";
          #urlbar .search-one-offs {
            display: none !important;
          }
          #tabbrowser-tabpanels{
            background-color: #${colo.background} !important;
          }
        '';
        userContent = ''
          @import "firefox-gnome-theme/userContent.css";
          @-moz-document url("about:home"),url("about:blank"),url("about:newtab"),url("about:privatebrowsing") {
            body{ background-color: #${colo.background} !important }
          }
        '';
      };
    };
  };
}