Better change background script

This commit is contained in:
Filippo Berto 2021-10-18 15:57:16 +02:00
parent c272958a51
commit 4833402f65
2 changed files with 6 additions and 2 deletions

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixos-unstable> { inherit system; } { pkgs ? import <nixos> { inherit system; }
, system ? builtins.currentSystem , system ? builtins.currentSystem
}: }:

View file

@ -14,7 +14,11 @@ let
in in
writeScript "update-background.sh" '' writeScript "update-background.sh" ''
#!/bin/sh #!/bin/sh
image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1` if [ $# -eq 0 ]; then
image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1`
else
image="$1"
fi
echo "image: $image" echo "image: $image"
${feh}/bin/feh --bg-fill --no-fehbg "$image" ${feh}/bin/feh --bg-fill --no-fehbg "$image"
${glib}/bin/gsettings set org.gnome.desktop.background picture-uri "file://$image" ${glib}/bin/gsettings set org.gnome.desktop.background picture-uri "file://$image"