Last active
May 18, 2019 17:08
-
-
Save ccnokes/4b98664514857a58a135b6ddb4b2c7fc to your computer and use it in GitHub Desktop.
Set your wallpaper to the current Astronomy Picture of the Day (APOD)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get the URL of the current Astronomy Picture of the Day (APOD) | |
apod_url=$(curl -s https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY | jq -r '.hdurl') | |
# get just the image name from the URL | |
filepath=$(basename "$apod_url") | |
# Now get the image and save it | |
curl -s -o "$filepath" "$apod_url" | |
# Use AppleScript to set it as the wallpaper | |
osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"$PWD/$filepath\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment