Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. URL="http://alpha.wallhaven.cc/search?categories=111&purity=100&resolutions=1920x1080&sorting=random&order=asc"
  4. WID_XPATH="//*[@id=\"thumbs\"]/section/ul/li[1]/figure/@data-wallpaper-id"
  5. WID=`xidel $URL --user-agent="Mozilla/5.0" -e $WID_XPATH`
  6.  
  7. if [ $? == 0 ]; then
  8. FILENAME="wallhaven-${WID}.jpg"
  9. WALLPAPER_URL="http://wallpapers.wallhaven.cc/wallpapers/full/$FILENAME"
  10. WALLPAPER_FILE="/media/data/Pictures/$FILENAME"
  11.  
  12. wget -c $WALLPAPER_URL -O $WALLPAPER_FILE
  13.  
  14. if [ $? == 0 ]; then
  15. ln -sf $WALLPAPER_FILE "${HOME}/.i3/wallpaper"
  16. feh --bg-scale $WALLPAPER_FILE
  17. fi
  18. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement