Skip to content

Instantly share code, notes, and snippets.

@lesthack
Created December 19, 2018 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lesthack/4815dae50e60aca5c4acdee107744776 to your computer and use it in GitHub Desktop.
Save lesthack/4815dae50e60aca5c4acdee107744776 to your computer and use it in GitHub Desktop.
#/bin/bash
# Paths
home_path="/home/user"
wallpapers_path="$home_path/Wallpapers"
# Test Internet Connection
wget -q --spider http://google.com
if [ $? -eq 0 ]; then
echo "Download to Internet"
wallpaper_name=`date +"%s%3N"`.jpg
wget -O "$wallpapers_path/$wallpaper_name" https://unsplash.it/2560/1440/?random
else
echo "Set last wallpaper"
wallpaper_name=`ls -t $wallpapers_path | head -1`
fi
ln -sf "$wallpapers_path/$wallpaper_name" /tmp/wallpaper.jpg
gsettings set org.gnome.desktop.background picture-uri "file:///tmp/wallpaper.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment