summaryrefslogtreecommitdiff
path: root/common/modules/matugen/default.nix
blob: 973bd8ea7cff323e230d788707a328394aa45a2e (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
{
  homeManager,
  inputs,
  moduleNameSpace,
  ...
}:

{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.${moduleNameSpace}.matugen;
in
{
  imports = lib.optionals homeManager [ ./templates ];

  options.${moduleNameSpace}.matugen = {
    enable = lib.mkEnableOption "Enable Dynamic colors";
  };

  config = lib.mkIf (cfg.enable && config.beeMods.windowManagers.beeConfig.enable) (
    lib.optionalAttrs homeManager {
      xdg.configFile = {
        "matugen/config.toml" = {
          text =
            # toml
            ''
                [config]
              ${lib.optionalString config.programs.zathura.enable ''
                [templates.zathura]
                input_path = '~/.config/matugen/templates/zathura.toml'
                output_path = '~/.config/zathura/matugen'
              ''}

              ${lib.optionalString config.beeMods.terminal.foot ''
                [templates.foot]
                input_path = '~/.config/matugen/templates/foot-colors.ini'
                output_path = '~/.config/foot/themes/matugen'
              ''}

              ${lib.optionalString config.beeMods.terminal.alacritty ''
                [templates.alacritty]
                input_path = '~/.config/matugen/templates/alacritty-colors.toml'
                output_path = '~/.config/alacritty/themes/matugen.toml'
              ''}

              ${lib.optionalString config.beeMods.terminal.ghostty ''
                [templates.ghostty]
                input_path = '~/.config/matugen/templates/ghostty-colors.conf'
                output_path = '~/.config/ghostty/themes/matugen'
                post_hook = 'pkill -SIGUSR2 ghostty'
              ''}

              ${lib.optionalString config.programs.btop.enable ''
                [templates.btop]
                input_path = '~/.config/matugen/templates/btop.theme'
                output_path = '~/.config/btop/themes/matugen.theme'
              ''}

              ${lib.optionalString config.programs.yazi.enable ''
                [templates.yazi]
                input_path = '~/.config/matugen/templates/yazi.toml'
                output_path = '~/.config/yazi/theme.toml'
              ''}

              ${lib.optionalString config.programs.vesktop.enable ''
                [templates.vesktop-midnight]
                input_path = "~/.config/matugen/templates/discord-midnight.css"
                output_path = "~/.config/vesktop/themes/midnight.css"

                [templates.vesktop-system24]
                input_path = "~/.config/matugen/templates/discord-system24.css"
                output_path = "~/.config/vesktop/themes/system24.css"
              ''}

              ${lib.optionalString config.services.dunst.enable ''
                [templates.dunst]
                input_path = '~/.config/matugen/templates/dunstrc'
                output_path = '~/.config/dunst/dunstrc.d/colors.conf'
                post_hook = "dunstctl reload"
              ''}

              ${lib.optionalString config.programs.rofi.enable ''
                [templates.rofi]
                input_path = '~/.config/matugen/templates/rofi-colors.rasi'
                output_path = '~/.config/rofi/shared/colors.rasi'
              ''}

              ${lib.optionalString (config.gtk.theme.name == "adw-gtk3") ''
                [templates.gtk3]
                input_path = '~/.config/matugen/templates/gtk.css'
                output_path = '~/.config/gtk-3.0/matugen.css'

                [templates.gtk4]
                input_path = '~/.config/matugen/templates/gtk.css'
                output_path = '~/.config/gtk-4.0/matugen.css'
              ''}

              ${lib.optionalString config.beeMods.windowManagers.niri.enable ''
                [templates.niri]
                input_path = '~/.config/matugen/templates/niri.kdl'
                output_path = '~/.config/niri/matugen.kdl'
              ''}

              [templates.neovim]
              input_path = '~/.config/matugen/templates/neovim.json'
              output_path = '~/.config/neovim/nvim-colors.json'

              [templates.waybarStyle]
              input_path = '~/.config/matugen/templates/waybar.css'
              output_path = '~/.config/waybar/style.css'

              [templates.waybarConfig]
              input_path = '~/.config/matugen/templates/waybar.jsonc'
              output_path = '~/.config/waybar/config.jsonc'
              post_hook = 'pkill -SIGUSR2 waybar'


              ${lib.optionalString
                (config.beeMods.terminal.default == "foot" || config.beeMods.terminal.default == "ghostty")
                ''
                  [templates.sequences]
                  input_path = '~/.config/matugen/templates/sequences'
                  output_path = '~/.config/beestuff/sequences'
                  post_hook = "sh '${config.home.homeDirectory}/.config/beestuff/sequences'"
                ''
              }
            '';
        };
      };
    }
  );
}