NixOS/home/modules/hyprland/wallust/default.nix

79 lines
1.9 KiB
Nix
Raw Normal View History

2024-10-21 22:40:16 +07:00
{
pkgs,
unstable,
lib,
config,
...
}:
let
cfg = config.profile.hyprland;
inherit (lib.meta) getExe;
wallpaperDir = "${config.home.homeDirectory}/.cache/wallpaper";
initWallPaperScript =
pkgs.writeShellScriptBin "init-wallpaper.sh"
# sh
''
init_wallpaper="${./wallpaper.jpeg}"
cache_file="${wallpaperDir}/current"
blurred="${wallpaperDir}/blurred.png"
square="${wallpaperDir}/square.png"
mkdir -p "${wallpaperDir}"
if [ ! -f "$cache_file" ]; then
cp "$init_wallpaper" "$cache_file"
fi
if [ ! -f "$blurred" ]; then
${pkgs.graphicsmagick}/bin/gm convert -resize 75% -blur 50x30 "$cache_file" "$blurred"
fi
if [ ! -f "$square" ]; then
${pkgs.imagemagick}/bin/magick "$cache_file" -resize 25% -gravity Center -extent 1:1 "$square"
fi
if [ ! -f "${config.home.homeDirectory}/.cache/wallust/sequences" ]; then
wallust run "$cache_file"
fi
'';
in
{
imports = [
./alacritty.nix
./foot.nix
./hyprland.nix
./kitty.nix
./rofi.nix
2024-10-23 19:54:15 +07:00
./swaync.nix
./waybar.nix
./wlogout.nix
];
config = lib.mkIf cfg.enable {
home.packages = [
pkgs.imagemagick
unstable.wallust
];
wayland.windowManager.hyprland.settings.exec-once = lib.mkOrder 10 ([
(getExe initWallPaperScript)
]);
2024-10-21 20:38:05 +07:00
# See https://codeberg.org/explosion-mental/wallust/src/branch/master/wallust.toml
home.file.".config/wallust/wallust.toml".source = (
2024-10-21 22:40:16 +07:00
(pkgs.formats.toml { }).generate "wallust.toml" (
lib.attrsets.mergeAttrsList [
{
backend = "kmeans";
color_space = "lch";
alpha = 100;
threshold = 1;
palette = "dark";
check_contrast = true;
2024-10-21 22:40:16 +07:00
}
cfg.wallust.settings
]
)
);
};
}