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"
|
|
|
|
|
|
|
|
mkdir -p "${wallpaperDir}"
|
|
|
|
echo "$image_file" > "${wallpaperDir}/origin.txt"
|
|
|
|
cp "$image_file" "$target"
|
|
|
|
swww img "$target"
|
|
|
|
${unstable.wallust}/bin/wallust run "$target"
|
|
|
|
${pkgs.imagemagick}/bin/gm convert -resize 75% -blur 50x30 "$target" "$blur_target"
|
|
|
|
'';
|
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
|
|
|
|
unstable.swww
|
|
|
|
];
|
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 = {
|
|
|
|
exec-once = [ "pypr" ];
|
|
|
|
bind = [
|
|
|
|
"$mod, W, exec, pypr wall next"
|
|
|
|
];
|
|
|
|
};
|
2024-06-12 09:54:11 +07:00
|
|
|
};
|
|
|
|
}
|