nix-dotfiles/pkgs/wl-update-background/default.nix

16 lines
408 B
Nix

{ findutils
, gnugrep
, coreutils
, writeShellScriptBin
, swww
, backgrounds_directory ? "$HOME/Immagini/Sfondi/"
}: writeShellScriptBin "wl-update-background" ''
set -e
if [ $# -eq 0 ]; then
image=`${findutils}/bin/find ${backgrounds_directory} -type f | ${gnugrep}/bin/grep -v "/\." | ${coreutils}/bin/shuf -n 1`
else
image="$1"
fi
echo "image: $image"
${swww}/bin/swww img "$image"
''