Created
June 21, 2017 12:29
-
-
Save janoamaral/4c9191b25a83f6a243e30f09567de9ec to your computer and use it in GitHub Desktop.
Change the wallpaper every hour using Unsplash.com API.
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 | |
# TODO: | |
# Add switch to change the wait period | |
# Add switch to change the image geometry | |
while [ : ] | |
do | |
wget --quiet -O ~/dotfiles/bg.jpg `curl -s "https://api.unsplash.com/photos/random/?client_id=YOUR_UNSPLASH_CLIENTE_ID" | grep -E "full\":\"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" -o | grep -E "https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)" -o` | |
# Resize the image to optimize | |
convert ~/bg.jpg -resize 1280 ~/bg.jpg | |
# Set the background | |
feh --bg-fill ~/bg.jpg | |
# Wait 1 hour | |
sleep 1h | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment