{ config, lib, pkgs, inputs, ... }:

with lib;
let
  cfg = config.samfelag.modules.desktop.tools.hyprpaper;
in
{
  options.samfelag.modules.desktop.tools.hyprpaper = {
    enable = mkEnableOption "Hyprpaper desktop wallpaper";
  };

  config = mkIf cfg.enable {

    hm.services.hyprpaper = {
      enable = true;
      settings = {
        preload = "${config.samfelag.modules.desktop.wallpaper}";
        wallpaper = ",${config.samfelag.modules.desktop.wallpaper}";
      };
    };

    # - Execute on startup -----------------------
    hm.wayland.windowManager.hyprland.settings.exec-once = [
      "hyprpaper"
    ];

  };
}
