{
  config,
  lib,
  namespace,
  ...
}:
let
  cfg = config.${namespace}.desktop.hyprland;
in
{
  imports = [ ../../options.nix ];

  config = lib.mkIf cfg.enable {
    programs.hyprlock = {
      enable = true;
      settings = {
        background = [
          {
            monitor = "";
            path = cfg.wallpaper; # supports png, jpg, webp (no animations, though)
            color = "rgba(25, 20, 20, 1.0)";

            # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations
            blur_passes = "3"; # 0 disables blurring
            blur_size = "7";
            noise = "0.0117";
            contrast = "0.8916";
            brightness = "0.8172";
            vibrancy = "0.1696";
            vibrancy_darkness = "0.0";
          }
        ];
        input-field = [
          {
            size = "200, 50";
            position = "0, -80";
            monitor = cfg.primaryDisplay;
            dots_center = true;
            fade_on_empty = true;
            font_color = "rgb(202, 211, 245)";
            inner_color = "rgb(91, 96, 120)";
            outer_color = "rgb(24, 25, 38)";
            bothlock_color = -1;
            outline_thickness = 5;
            placeholder_text = ''<span foreground="##cad3f5">Password...</span>'';
            shadow_passes = 2;
          }
        ];
      };
    };
  };
}
