21 lines
528 B
Nix
21 lines
528 B
Nix
{ lib
|
|
, stdenv
|
|
, feh
|
|
, glib
|
|
, 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"
|
|
${glib}/bin/gsettings set org.gnome.desktop.background picture-uri "file://$image"
|
|
''
|