changepaper.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. # This Script downloads National Geographic Photo of the day, and sets it as desktop background (gnome, unity)
  3. # Copyright (C) 2012 Saman Barghi - All Rights Reserved
  4. # Permission to copy, modify, and distribute is granted under GPLv3
  5. # Last Revised 22 May 2019
  6. #######################
  7. # For feh, we need display set properly
  8. export DISPLAY=:0.0
  9. export XAUTHORITY=/home/powellc/.Xauthority
  10. # Choices: astrobin,natgeo,nasa,unsplash
  11. BASEDIR="$HOME/var/backgrounds/bing/"
  12. SEARX_BASEDIR="$HOME/var/backgrounds/natgeo/"
  13. # Get daily NatGeo POTD
  14. python3 ~/.bin/get_natgeo_potd.py
  15. python3 ~/.bin/get_astrobin_potd.py
  16. python3 ~/.bin/get_unsplash_potd.py
  17. python3 ~/.bin/get_bing_potd.py
  18. date=$(date '+%Y-%m-%d')
  19. #set the current image as wallpaper
  20. echo "Setting desktop background"
  21. hsetroot -cover $BASEDIR/$date.jpg
  22. #link slim background to new image
  23. SLIM_BG_FILE=/usr/share/slim/themes/default/background.jpg
  24. if test -f "$SLIM_BG_FILE"; then
  25. echo "Setting Slim background image"
  26. rm $SLIM_BG_FILE
  27. ln -s $BASEDIR/$date.jpg $SLIM_BG_FILE
  28. fi
  29. SEARX_BG_FILE=/usr/local/lib/python2.7/site-packages/searx/static/themes/courgette/img/bg-body-index.jpg
  30. if test -f "$SEARX_BG_FILE"; then
  31. echo "Setting Searx background image"
  32. rm $SEARX_BG_FILE
  33. cp $SEARX_BASEDIR/$date.jpg $SEARX_BG_FILE
  34. fi
  35. # Then grab our APOD image and store it for now
  36. #Change directory to where the script resides.
  37. #BASEDIR="$HOME/var/inbox/apod_photos"
  38. #cd $BASEDIR
  39. ########################
  40. #
  41. ## Get the APoD image from NASA
  42. #img="$(curl https://api.nasa.gov/planetary/apod\?api_key=AdfgdnmmInYgpDMEq3ShMLKjJ7DZ7jyUcgLHWdgw | jq .hdurl | tr -d \")"
  43. #
  44. ##check to see if there is any wallpaper to download
  45. #if [ -n "$img" ]
  46. #then
  47. # img_file=`echo $img | cut -d/ -f 7 | tr -d \"`
  48. # curl $img > $img_file
  49. # #set the current image as wallpaper
  50. # #hsetroot -sane $BASEDIR/$img_file
  51. # ##link slim background to new image
  52. # #rm /usr/share/slim/themes/default/background.jpg
  53. # #ln -s $BASEDIR/$img_file /usr/share/slim/themes/default/background.jpg
  54. #else
  55. # echo "No Wallpaper today"
  56. #fi