Created
December 19, 2018 20:44
-
-
Save lesthack/4815dae50e60aca5c4acdee107744776 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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