fixing bingwp finally

This commit is contained in:
Ivan Dimitrov 2023-12-26 12:37:28 +02:00
parent d2c635c98d
commit ef9362e56f
2 changed files with 5 additions and 3 deletions

View File

@ -7,15 +7,17 @@ mkdir -p "$bg_dir"
isNew() {
if (( 10 <= 10#$(date +%H) )) && [[ ! -e "$img_file" ]]; then
return 0
else
elif [ ! -s "$img_file" ]; then
img_file="$bg_dir/$(date -d 'now - 1 days' +%Y-%m-%d).png"
return 1
else
return 1
fi
}
fetch() {
img_url="$(curl "https://www.bing.com/HPImageArchive.aspx?format=js&n=1" | jq ".images[0].url" | sed "s/\"//g" | awk '{printf "https://bing.com%s", $1 }')"
wget -O "$img_file" "$img_url"
curl "$img_url" > "$img_file"
}
isNew && fetch

View File

@ -31,7 +31,7 @@
bingwp = {
Service = {
Environment = [
"PATH=${pkgs.coreutils-full}/bin:${pkgs.curl}/bin:${pkgs.wget}/bin:${pkgs.xdg-user-dirs}/bin:${pkgs.jq}/bin:${pkgs.bash}/bin:${pkgs.swaybg}/bin"
"PATH=${pkgs.curl}/bin:${pkgs.jq}/bin:${pkgs.gnused}/bin:${pkgs.gawk}/bin:${pkgs.coreutils-full}/bin:${pkgs.xdg-user-dirs}/bin:${pkgs.bash}/bin:${pkgs.swaybg}/bin"
"WAYLAND_DISPLAY=wayland-1"
];
ExecStart = [ "${pkgs.scripts}/bin/bingwp" ];