fixing bingwp finally
This commit is contained in:
parent
d2c635c98d
commit
ef9362e56f
@ -7,15 +7,17 @@ mkdir -p "$bg_dir"
|
|||||||
isNew() {
|
isNew() {
|
||||||
if (( 10 <= 10#$(date +%H) )) && [[ ! -e "$img_file" ]]; then
|
if (( 10 <= 10#$(date +%H) )) && [[ ! -e "$img_file" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
elif [ ! -s "$img_file" ]; then
|
||||||
img_file="$bg_dir/$(date -d 'now - 1 days' +%Y-%m-%d).png"
|
img_file="$bg_dir/$(date -d 'now - 1 days' +%Y-%m-%d).png"
|
||||||
return 1
|
return 1
|
||||||
|
else
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch() {
|
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 }')"
|
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
|
isNew && fetch
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
bingwp = {
|
bingwp = {
|
||||||
Service = {
|
Service = {
|
||||||
Environment = [
|
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"
|
"WAYLAND_DISPLAY=wayland-1"
|
||||||
];
|
];
|
||||||
ExecStart = [ "${pkgs.scripts}/bin/bingwp" ];
|
ExecStart = [ "${pkgs.scripts}/bin/bingwp" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user