Small script for setting a random reddit wallpaper on Openbox

Recently I tuned my computer at work, and set Openbox as my desktop environment, which is my favorite Linux desktop envorinment, with my usual keybindings, configuration files and so.

For setting a wallpaper I wasn't decided for any so I created this small bash script for setting a wallpaper chosing by reddit every time I start the pc

rm ~/wallpaper.jpg  
ID="$(wget -q "" -O - | grep '"post"' | grep class | cut -d\" -f 2 | head -1)"  
echo "Downloading $ID.jpg"  
wget -c -q -N "$ID.jpg" -O ~/wallpaper.jpg  
feh --bg-fill ~/wallpaper.jpg  

This script will get an image from using wget and will save it into your home folder, then using feh will set it as the wallpaper. You can change /r/wallpapers for like /r/EarthPorn for a different subreddit.

Then save the script in your home folder as, set it to executable using chmod and add the execution of this script to the startup of openbox adding the following line to ~/.config/openbox/autostart :

sh ~/