{ lib, config, ... }:
let
  inherit (lib) mkIf;

  swayncFolder = ".config/swaync";
  themes = import ./themes;
in
mkIf config.services.swaync.enable {
  services.swaync = {
    style = themes.gruvbox;
    settings = import ./config.nix;
  };

  home.file = lib.mapAttrs' (
    name: value:
    lib.nameValuePair "swaync-theme-${name}" {
      enable = true;
      target = "${swayncFolder}/${name}.css";
      text = value;
    }
  ) themes;
}
