Skip to content

Instantly share code, notes, and snippets.

@zviryatko
Last active December 19, 2016 21:26
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 zviryatko/055f8f4850bf17323c4f127a4daeccdf to your computer and use it in GitHub Desktop.
Save zviryatko/055f8f4850bf17323c4f127a4daeccdf to your computer and use it in GitHub Desktop.
Get random wallpaper from http://desktoppr.co/
#!/bin/bash
# Download random wallpaper from desktoppr.co
# Save this file:
# $ curl -s https://gist.githubusercontent.com/zviryatko/055f8f4850bf17323c4f127a4daeccdf/raw/random-wallpaper.sh > $HOME/.local/bin/random-wallpaper
# $ chmod a+x $HOME/.local/bin/random-wallpaper
# $ crontab -e
# and add this line to the end:
# */20 * * * * $HOME/.local/bin/random-wallpaper
IMG_PATH="$HOME/.cache/wallpaper.jpg"
curl -s `curl -s https://api.desktoppr.co/1/wallpapers/random | python -c "import json,sys; obj=json.load(sys.stdin); print obj['response']['image']['url'];"` > $IMG_PATH
# I've used "feh" for setting bg image, you can install it with `apt-get install feh`
DISPLAY=:0.0 feh --bg-fill $IMG_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment