{
  config,
  lib,
  ...
}: {
  imports = [../../xdg];

  options.dotfiles.inputs.home-manager.programs.zathura.enable =
    lib.dotfiles.mkEnableOption;

  config =
    lib.mkIf
    config.dotfiles.inputs.home-manager.programs.zathura.enable
    (
      lib.mkMerge [
        {
          programs.zathura = {
            enable = true;
            options.recolor = true;
          };
        }

        (
          lib.mkIf
          (
            config.dotfiles.inputs.home-manager.home.packages.gimp.enable
            or false
          )
          {
            dotfiles.inputs.home-manager.xdg.mimeApps.enable = true;

            xdg.mimeApps.defaultApplications =
              lib.mapAttrs'
              (name: lib.nameValuePair "application/${name}")
              {
                "pdf" = ["org.pwmt.zathura-pdf-mupdf.desktop"];
                "postscript" = ["org.pwmt.zathura-ps.desktop"];
              };
          }
        )
      ]
    );
}
