nix-dotfiles/custom/update-background/default.nix

12 lines
430 B
Nix

{ lib, stdenv, feh, findutils, gnugrep, coreutils, writeScript, backgrounds_directory ? "$HOME/Immagini/Sfondi" }:
let
find = "${findutils}/bin/find";
grep = "${gnugrep}/bin/grep";
shuf = "${coreutils}/bin/shuf";
in
writeScript "update-background.sh" ''
#!/bin/sh
image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1`
echo "image: $image"
${feh}/bin/feh --bg-fill --no-fehbg "$image"
''