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

{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.${moduleNameSpace}.matugen;
  # link_zen = pkgs.writeShellScript "link_zen" ''
  #   export PROFILE_DIR=$(find ~/.config/zen/ -maxdepth 1 -type d -name "*.Default Profile" | head -n 1)
  #   mkdir -p "$PROFILE_DIR/chrome"
  #   ln -sf ~/.cache/wallust/userChrome.css "$PROFILE_DIR/chrome/userChrome.css"
  #   ln -sf ~/.config/userContent.css "$PROFILE_DIR/chrome/userContent.css"
  # '';
  update_gtkcolors = pkgs.writeShellScript "update_gtkcolors" ''
    dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
    sleep 0.1
    dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"

    systemctl --user restart xdg-desktop-portal-gtk
  '';
in
{
  imports = lib.optionals homeManager [ ./templates ];

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

  config = lib.mkIf cfg.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.mango.enable ''
                [templates.mango]
                input_path = '~/.config/matugen/templates/mango.conf'
                output_path = '~/.config/mango/mango-colors.conf'
                post_hook = 'mmsg -d reload_config'
              ''}

              ${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.beeMods.dwm.enable) ''
                [templates.Xresources]
                input_path = "~/.config/matugen/templates/colors-xresources"
                output_path = "~/.config/x11/matugen.Xresources"
              ''}

              ${lib.optionalString config.programs.vesktop.enable ''
                [templates.vesktop]
                input_path = "~/.config/matugen/templates/vesktop.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.beeMods.beeVim.enable ''
                [templates.neovim]
                input_path = "~/.config/matugen/templates/neovim.json"
                output_path = "~/.config/matugen/neovim_matugen.json"
              ''}

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