Last active
May 27, 2019 01:05
-
-
Save Rio6/25faf9d36ef1a0b28bf4f54fba931feb to your computer and use it in GitHub Desktop.
Use apod as wallpaper
This file contains hidden or 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
| #!/bin/sh | |
| #wait for internet | |
| while ! ping -q -w 1 -c 1 apod.nasa.gov > /dev/null; do sleep 5; done | |
| html=$(curl https://apod.nasa.gov/apod/astropix.html) | |
| yturl=$(grep -Eom1 "https://www.youtube.com/embed/[^\"]+" <<< "$html") | |
| if [ ! -z $yturl ]; then | |
| youtube-dl "$yturl" -o /tmp/apod | |
| name=$(echo /tmp/apod.* | cut -f 1 -d ' ') | |
| mplayer -rootwin -fs -nosound -loop 0 -nostop-xscreensaver $name | |
| fi | |
| imgpath=$(grep -Eio "image.*(jpg|png|gif)" <<< "$html" | head -n 1) | |
| if [ ! -z $imgpath ]; then | |
| curl "https://apod.nasa.gov/$imgpath" | feh --bg-max --no-fehbg - && exit | |
| exit | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment