Files
nixos/apps/hyprpaper/switch-wallpaper.nix
T
kenji f8cdd03c17 t
2025-12-27 20:00:13 -06:00

27 lines
687 B
Nix

{pkgs, ...}: {
home.packages = with pkgs; [
(writeShellScriptBin "switch-wallpaper" ''
tmp_file=$(mktemp)
target_dir="$HOME/.config/nixos/assets/Wallpapers"
if [ ! -d "$target_dir" ]; then
target_dir="$HOME"
fi
${pkgs.yazi}/bin/yazi "$target_dir" --chooser-file="$tmp_file"
WALLPAPER=$(cat "$tmp_file")
rm -f "$tmp_file"
if [ -z "$WALLPAPER" ]; then
exit 0
fi
# ${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WALLPAPER"
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WALLPAPER"
exec matugen image $WALLPAPER
'')
];
}