11.stylix/modules/wpaperd/hm.nix
awwpotato 7ffb31da69
treewide: use mkTarget (batch 2) (#1362)
Link: https://github.com/nix-community/stylix/pull/1362

Reviewed-by: Flameopathic <64027365+Flameopathic@users.noreply.github.com>
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
2025-05-23 19:23:39 +02:00

32 lines
843 B
Nix

{ mkTarget, lib, ... }:
mkTarget {
name = "wpaperd";
humanName = "wpaperd";
configElements =
{ imageScalingMode, image }:
(
let
# wpaperd doesn't have any mode close to the described behavior of center
modeMap = {
"stretch" = "stretch";
# wpaperd's center mode is closest to the described behavior of fill
"fill" = "center";
"fit" = "fit";
"tile" = "tile";
};
modeAttrs =
if builtins.hasAttr imageScalingMode modeMap then
{ mode = modeMap.${imageScalingMode}; }
else
lib.info "stylix: wpaperd: unsupported image scaling mode: ${imageScalingMode}"
{ };
in
{
services.wpaperd.settings.any = {
path = "${image}";
} // modeAttrs;
}
);
}