mirror of
https://github.com/EdenQwQ/nixos.git
synced 2025-12-26 18:34:56 +08:00
use attrsets for effects
This commit is contained in:
parent
d369e98e00
commit
1f575eb8a6
3 changed files with 29 additions and 33 deletions
|
|
@ -41,11 +41,15 @@ let
|
|||
name,
|
||||
path,
|
||||
}:
|
||||
effect:
|
||||
if hasAttr effect.name config.lib.wallpapers.effects then
|
||||
config.lib.wallpapers.effects.${effect.name} { inherit name path; } // effect.passthru
|
||||
effectName: effectOptions:
|
||||
if config.lib.wallpapers.effects ? ${effectName} then
|
||||
config.lib.wallpapers.effects.${effectName} { inherit name path; } // effectOptions
|
||||
else
|
||||
path;
|
||||
# if hasAttr effect.name config.lib.wallpapers.effects then
|
||||
# config.lib.wallpapers.effects.${effect.name} { inherit name path; } // effect.passthru
|
||||
# else
|
||||
# path;
|
||||
|
||||
applyEffects =
|
||||
wallpaper:
|
||||
|
|
@ -66,13 +70,15 @@ let
|
|||
{ inherit path; }
|
||||
else
|
||||
{
|
||||
path = foldl' (
|
||||
acc: elem:
|
||||
applyEffect {
|
||||
inherit name;
|
||||
path = acc;
|
||||
} elem
|
||||
) path effects;
|
||||
path =
|
||||
lib.attrsets.filterAttrs (_: v: v.enable == true) effects
|
||||
|> lib.attrsets.foldlAttrs (
|
||||
acc: effectName: effectOptions:
|
||||
applyEffect {
|
||||
inherit name;
|
||||
path = acc;
|
||||
} effectName effectOptions
|
||||
) path;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,15 @@
|
|||
baseImageName = "frieren-butterflies";
|
||||
path = "${pkgs.wallpapers}/frieren-butterflies.jpg";
|
||||
convertMethod = "lutgen";
|
||||
effects = [
|
||||
{
|
||||
name = "hydrogen";
|
||||
passthru = {
|
||||
effects = {
|
||||
hydrogen = {
|
||||
enable = true;
|
||||
options = {
|
||||
extraArguments = "--shadow-arguments '80x50+0+0'";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "vignette";
|
||||
}
|
||||
];
|
||||
};
|
||||
vignette.enable = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "frieren-fire.jpg";
|
||||
|
|
@ -51,11 +49,7 @@
|
|||
baseImageName = "bangqiaoyan-girl-sky";
|
||||
path = "${pkgs.wallpapers}/bangqiaoyan-girl-sky.jpg";
|
||||
convertMethod = "gonord";
|
||||
effects = [
|
||||
{
|
||||
name = "hydrogen";
|
||||
}
|
||||
];
|
||||
effects.hydrogen.enable = true;
|
||||
}
|
||||
{
|
||||
name = "morncolour-pink-landscape.png";
|
||||
|
|
|
|||
|
|
@ -27,22 +27,18 @@ let
|
|||
};
|
||||
effects = mkOption {
|
||||
type = nullOr (
|
||||
listOf (submodule {
|
||||
attrsOf (submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Name of the effect to apply";
|
||||
default = null;
|
||||
};
|
||||
passthru = mkOption {
|
||||
enable = mkEnableOption "Enable this effect";
|
||||
options = mkOption {
|
||||
type = attrs;
|
||||
description = "Extra arguments to pass to the effect";
|
||||
description = "Options for the effect";
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
})
|
||||
);
|
||||
description = "List of effects to apply to the wallpaper";
|
||||
description = "Effects to apply to the wallpaper";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue