2024-05-21 14:53:46 -07:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
2024-10-20 11:23:59 -07:00
|
|
|
}: let
|
|
|
|
inherit (config.rose-pine) sources;
|
|
|
|
|
|
|
|
cfg = config.services.mako.rose-pine;
|
2023-11-02 08:55:47 -07:00
|
|
|
enable = cfg.enable && config.services.mako.enable;
|
2024-10-20 11:23:59 -07:00
|
|
|
|
|
|
|
themeName =
|
|
|
|
if (cfg.flavor == "main")
|
|
|
|
then "rose-pine"
|
|
|
|
else "rose-pine-${cfg.flavor}";
|
|
|
|
theme = lib.rp.fromINI (sources.mako + "/theme/${themeName}.theme");
|
2023-11-02 08:55:47 -07:00
|
|
|
|
|
|
|
# Settings that need to be extracted and put in extraConfig
|
2024-10-20 11:23:59 -07:00
|
|
|
extraConfigAttrs = lib.attrsets.getAttrs ["urgency=high"] theme;
|
|
|
|
in {
|
|
|
|
options.services.mako.rose-pine =
|
|
|
|
lib.rp.mkRosePineOpt {name = "mako";};
|
2023-11-02 08:55:47 -07:00
|
|
|
|
2024-10-20 11:23:59 -07:00
|
|
|
# Will cause infinite recursion if config.services.mako is directly set as a
|
|
|
|
# whole.
|
2023-11-02 08:55:47 -07:00
|
|
|
config.services.mako = lib.mkIf enable {
|
|
|
|
backgroundColor = theme.background-color;
|
|
|
|
textColor = theme.text-color;
|
|
|
|
borderColor = theme.border-color;
|
|
|
|
progressColor = theme.progress-color;
|
2024-05-21 14:53:46 -07:00
|
|
|
extraConfig = builtins.readFile (
|
2024-10-20 11:23:59 -07:00
|
|
|
(pkgs.formats.ini {}).generate "mako-extra-config" extraConfigAttrs
|
2024-05-21 14:53:46 -07:00
|
|
|
);
|
2023-11-02 08:55:47 -07:00
|
|
|
};
|
|
|
|
}
|