{
  lib,
  pkgs,
  config,
  ...
}:
let
  inherit (lib)
    types
    mkIf
    mkEnableOption
    mkPackageOption
    mkOption
    ;

  cfg = config.programs.mpvpaper;
in
{

  options.programs.mpvpaper = {
    enable = mkEnableOption "mpvpaper";
    package = mkPackageOption pkgs "mpvpaper" { nullable = true; };
    pauseList = mkOption {
      type = types.lines;
      default = "";
      example = ''
        firefox
        steam
        obs
      '';
      description = ''
        List of program names that will cause mpvpaper to pause.
        Programs must be separated by spaces or newlines.
      '';
    };
    stopList = mkOption {
      type = types.lines;
      default = "";
      example = ''
        firefox
        steam
        obs
      '';
      description = ''
        List of program names that will cause mpvpaper to stop.
        Programs must be separated by spaces or newlines.
      '';
    };
  };

  config = mkIf cfg.enable {
    assertions = [
      (lib.hm.assertions.assertPlatform "programs.mpvpaper" pkgs lib.platforms.linux)
    ];

    home.packages = mkIf (cfg.package != null) [ cfg.package ];
    xdg.configFile."mpvpaper/pauselist" = mkIf (cfg.pauseList != "") {
      text = cfg.pauseList;
    };
    xdg.configFile."mpvpaper/stoplist" = mkIf (cfg.stopList != "") {
      text = cfg.stopList;
    };
  };
}
