Skip to content

Instantly share code, notes, and snippets.

@stchris
Created February 7, 2011 18:57
Show Gist options
  • Save stchris/814962 to your computer and use it in GitHub Desktop.
Save stchris/814962 to your computer and use it in GitHub Desktop.
Gets the 'image of the day' from NASA and sets it as the wallpaper (in Gnome)
#!/bin/bash
# source: http://blog.quaternio.net/2009/04/13/nasa-image-of-the-day-as-gnome-background/
# grabs the nasa image of the day by RSS feed and updates the gnome
# background. add this to your cron jobs to have this happen daily. this is,
# obviously, a hack, that is likely to break at the slightest change of NASA's
# RSS implementation. yay standards!
rss=`wget -q -O - http://www.nasa.gov/rss/lg_image_of_the_day.rss`
img_url=`echo $rss | grep -o '<enclosure [^>]*>' | grep -o 'http://[^\"]*'`
img_name=`echo $img_url | grep -o [^/]*\.\w*$`
# this command is benign if the directory already exists.
mkdir -p $HOME/.backgrounds
# this command will overwrite the image if it already exists
wget -q -O $HOME/.backgrounds/$img_name $img_url
/usr/bin/gconftool-2 -t string --set \
/desktop/gnome/background/picture_filename $HOME/.backgrounds/$img_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment