summaryrefslogtreecommitdiff
path: root/modules/terminal/alacritty.nix
blob: 7dd445624e2c0ada41503eb992c8bfe95079b52d (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
{
  config,
  lib,
  ...
}: let
  inherit (lib) mkIf;
  cfg = config.terminal;
in {
  config = mkIf cfg.alacritty {
    default.terminal = lib.mkDefault "alacritty";

    home-manager.users.${config.user} = {
      programs.alacritty = {
        enable = true;

        settings = {
          # Font
          font = {
            size = 11;
            bold = {
              style = "Bold";
            };
            bold_italic = {
              style = "Bold Italic";
            };
            italic = {
              style = "Italic";
            };
            normal = {
              family = config.theme.font.monospace;
              style = "Regular";
            };
            offset = {
              x = 0;
              y = 0;
            };
          };

          # Window
          window = {
            decorations = "full";
            dynamic_title = true;
            padding = {
              x = config.theme.outerGap;
              y = config.theme.outerGap;
            };
            opacity = config.theme.opacity;
          };

          # Colors
          colors =
            (lib.attrsets.mapAttrs (
              group: colors:
                lib.attrsets.mapAttrs (name: color: "#${color}") colors
            ) {inherit (config.theme.colors) bright normal;})
            // {
              cursor = {
                background = "CellForeground";
                text = "CellBackground";
              };
              selection = {
                background = "CellForeground";
                text = "CellBackground";
              };
              primary = {
                foreground = "#${config.theme.colors.fg}";
                background = "#${config.theme.colors.bg}";
              };
            };
        };
      };
    };
  };
}