Skip to content

Instantly share code, notes, and snippets.

@Rio6
Last active May 27, 2019 01:05
Show Gist options
  • Select an option

  • Save Rio6/25faf9d36ef1a0b28bf4f54fba931feb to your computer and use it in GitHub Desktop.

Select an option

Save Rio6/25faf9d36ef1a0b28bf4f54fba931feb to your computer and use it in GitHub Desktop.
Use apod as wallpaper
#!/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