changepaper 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. if [ -n "$1" ]; then
  11. SOURCE=$1
  12. else
  13. SOURCE='astrobin'
  14. fi
  15. # Choices: astrobin,natgeo,nasa,unsplash,bing
  16. BASEDIR="$HOME/var/media/backgrounds/$SOURCE"
  17. SEARX_BASEDIR="$HOME/var/media/backgrounds/bing"
  18. # Get daily NatGeo POTD
  19. python3 ~/.bin/get_natgeo_potd.py
  20. python3 ~/.bin/get_astrobin_potd.py
  21. python3 ~/.bin/get_unsplash_potd.py
  22. python3 ~/.bin/get_bing_potd.py
  23. date=$(date '+%Y-%m-%d')
  24. #set the current image as wallpaper
  25. echo "Setting desktop background"
  26. hsetroot -cover $BASEDIR/$date.jpg
  27. #link slim background to new image
  28. SLIM_BG_FILE=/usr/share/slim/themes/default/background.jpg
  29. if test -f "$SLIM_BG_FILE"; then
  30. echo "Setting Slim background image"
  31. rm $SLIM_BG_FILE
  32. ln -s $BASEDIR/$date.jpg $SLIM_BG_FILE
  33. fi
  34. SEARX_BG_FILE=/usr/local/lib/python2.7/site-packages/searx/static/themes/courgette/img/bg-body-index.jpg
  35. echo "Setting Searx background image"
  36. scp $BASEDIR/$date.jpg search.local:$SEARX_BG_FILE
  37. # Then grab our APOD image and store it for now
  38. #Change directory to where the script resides.
  39. #BASEDIR="$HOME/var/inbox/apod_photos"
  40. #cd $BASEDIR
  41. ########################
  42. #
  43. ## Get the APoD image from NASA
  44. #img="$(curl https://api.nasa.gov/planetary/apod\?api_key=AdfgdnmmInYgpDMEq3ShMLKjJ7DZ7jyUcgLHWdgw | jq .hdurl | tr -d \")"
  45. #
  46. ##check to see if there is any wallpaper to download
  47. #if [ -n "$img" ]
  48. #then
  49. # img_file=`echo $img | cut -d/ -f 7 | tr -d \"`
  50. # curl $img > $img_file
  51. # #set the current image as wallpaper
  52. # #hsetroot -sane $BASEDIR/$img_file
  53. # ##link slim background to new image
  54. # #rm /usr/share/slim/themes/default/background.jpg
  55. # #ln -s $BASEDIR/$img_file /usr/share/slim/themes/default/background.jpg
  56. #else
  57. # echo "No Wallpaper today"
  58. #fi