2024-06-12 09:54:11 +07:00
|
|
|
{ lib, pkgs, unstable, config, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.profile.hyprland;
|
2024-10-17 08:39:52 +07:00
|
|
|
inherit (lib.meta) getExe;
|
|
|
|
wallpaperDir = "${config.home.homeDirectory}/.cache/wallpaper";
|
|
|
|
draw-wallpaper = pkgs.writeShellScriptBin "draw-wallpaper.sh" /*sh*/ ''
|
|
|
|
image_file=$1
|
|
|
|
target="${wallpaperDir}/current"
|
|
|
|
blur_target="${wallpaperDir}/blurred.png"
|
2024-10-17 12:37:14 +07:00
|
|
|
square_target="${wallpaperDir}/square.png"
|
2024-10-17 08:39:52 +07:00
|
|
|
|
|
|
|
mkdir -p "${wallpaperDir}"
|
|
|
|
echo "$image_file" > "${wallpaperDir}/origin.txt"
|
|
|
|
cp "$image_file" "$target"
|
|
|
|
swww img "$target"
|
|
|
|
${unstable.wallust}/bin/wallust run "$target"
|
2024-10-17 12:37:14 +07:00
|
|
|
${pkgs.graphicsmagick}/bin/gm convert -resize 75% -blur 50x30 "$target" "$blur_target"
|
|
|
|
${pkgs.imagemagick}/bin/magick "$target" -resize 25% -gravity Center -extent 1:1 "$square_target"
|
2024-10-17 08:39:52 +07:00
|
|
|
'';
|
2024-06-12 09:54:11 +07:00
|
|
|
in
|
|
|
|
{
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-10-17 08:39:52 +07:00
|
|
|
home.packages = [
|
|
|
|
unstable.pyprland
|
2024-10-20 11:03:56 +07:00
|
|
|
pkgs.swww
|
2024-10-17 08:39:52 +07:00
|
|
|
];
|
2024-06-12 09:54:11 +07:00
|
|
|
home.file.".config/hypr/pyprland.toml".source =
|
|
|
|
let
|
|
|
|
tomlFormat = pkgs.formats.toml { };
|
|
|
|
in
|
|
|
|
tomlFormat.generate "pyprland.toml" {
|
|
|
|
pyprland.plugins = [
|
|
|
|
"wallpapers"
|
|
|
|
];
|
|
|
|
wallpapers = {
|
|
|
|
path = cfg.pyprland.wallpaper-dirs;
|
|
|
|
unique = false;
|
2024-10-17 08:39:52 +07:00
|
|
|
command = ''${getExe draw-wallpaper} [file]'';
|
2024-06-12 09:54:11 +07:00
|
|
|
};
|
|
|
|
};
|
2024-10-17 08:39:52 +07:00
|
|
|
|
|
|
|
wayland.windowManager.hyprland.settings = {
|
2024-10-20 11:03:56 +07:00
|
|
|
exec-once = [
|
|
|
|
"pypr"
|
|
|
|
"swww-daemon"
|
|
|
|
"sleep 0.2 && swww img ${config.home.homeDirectory}/.cache/wallpaper/current"
|
|
|
|
];
|
2024-10-17 08:39:52 +07:00
|
|
|
bind = [
|
|
|
|
"$mod, W, exec, pypr wall next"
|
|
|
|
];
|
|
|
|
};
|
2024-06-12 09:54:11 +07:00
|
|
|
};
|
|
|
|
}
|