NASA IOTD Wallpaper
From awesome
Contents |
Credits
Credits to: NASA Image of the day as Gnome background
Requirements
run_once function (in your config):
function run_once(prg)
if not prg then
do return nil end
end
awful.util.spawn_with_shell("pgrep -f -u $USER -x " .. prg .. " || (" .. prg .. ")")
end
nasaBackground.sh:
#!/bin/bash # 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! #EDITED FOR feh 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 feh --bg-scale $HOME/.backgrounds/$img_name
Install
Put the nasaBackground.sh script to anywhere in your ~/ folder. Mine's here: ~/scripts/nasaBackground.sh
Using the run_once function, simply sh the nasaBackground.sh script.
run_once("sh /home/YOURUSERNAME/fooFolder/nasaBackground.sh")
Notes
When Awesome WM is run, it will take some time to download the image of the day etc. before the image is actually used as background. Something like 20-30 seconds I'd guess.
Take note that eventually the .background folder, that is created, will become pretty large. So keep an eye out for it, and reguarly erase it.
This can easily be modified for any other wallpaper-making-application instead of feh. You only need to modify the last line of nasaBackground.sh