aboutsummaryrefslogtreecommitdiff
path: root/modules/desktop/hjem/programs/firefox.nix
blob: b5ea4333d5aad099444730d572f24d431b83e133 (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
{
  pkgs,
  lib,
  config,
  inputs,
  ...
}: let
  cfg = config.collinux.desktop.programs.firefox;

  mkCssHacks = hacks: hacks |> map (f: ''@import "${inputs.firefox-csshacks}/chrome/${f}.css";'') |> lib.concatStringsSep "\n";
in
  lib.mkIf cfg.enable {
    files = {
      ".mozilla/firefox/profiles.ini" = {
        generator = lib.generators.toINI {};
        value = {
          Profile0 = {
            Name = "collin";
            IsRelative = 1;
            Path = "collin";
            Default = 1;
          };
          General = {
            StartWithLastProfile = 1;
            Version = 2;
          };
        };
      };

      ".mozilla/firefox/collin/chrome/userChrome.css".text = mkCssHacks (
        # (lib.optional (cfg.theme == "adwaita") "window_control_placeholder_support") ++
        [
          # Tabs
          (
            if cfg.theme == "catppuccin"
            then "hide_tabs_with_one_tab"
            else "hide_tabs_with_one_tab_w_window_controls"
          )
          "tabs_on_bottom_v2"
          "tab_close_button_always_on_hover"
          "tabs_fill_available_width"

          # Icons!
          "iconized_main_menu"
          "iconized_menubar_items"
          "iconized_places_context_menu"
          "iconized_tabs_context_menu"
          "icon_only_context_menu_text_controls"

          # Other
          "compact_extensions_panel"
        ]
      );
    };

    packages = [pkgs.firefox];
  }