summaryrefslogtreecommitdiff
path: root/modules/terminal/alacritty.nix
blob: 7addff0870075ddb23cc9dc09c1d915324034d5b (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
{
  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 = {
            normal = lib.attrsets.mapAttrs (name: color: "${color}") {
              inherit (config.theme.colors.normal)
                black
                red
                green
                yellow
                blue
                magenta
                cyan
                white;
            };

            bright = lib.attrsets.mapAttrs (name: color: "${color}") {
              inherit (config.theme.colors.bright)
                black
                red
                green
                yellow
                blue
                magenta
                cyan
                white;
            };

            cursor = {
              background = "CellForeground";
              text = "CellBackground";
            };

            selection = {
              background = "CellForeground";
              text = "CellBackground";
            };

            primary = {
              foreground = "#${config.theme.colors.text}";
              background = "#${config.theme.colors.base}";
            };
          };
        };
      };
    };
  };
}