apod-wallpaper/apod.sh
2017-12-16 00:37:23 +02:00

10 lines
476 B
Bash
Executable File

#!/bin/bash
NASA_APOD_BASE_URL="https://apod.nasa.gov/apod"
IMAGE_URL=`curl -s $NASA_APOD_BASE_URL/astropix.html | grep -oh 'href="image/.*"' | grep -oh 'image/.*jpg' | head -1`
if [ -z "$IMAGE_URL" ]; then
gsettings set org.gnome.desktop.background picture-uri "file:///home/pi2/Pictures/wallpapers/blue_galaxy_wallpaper.png"
else
curl -s "$NASA_APOD_BASE_URL/$IMAGE_URL" > image.jpg
gsettings set org.gnome.desktop.background picture-uri "file:///$(pwd)/image.jpg"
fi