changepaper 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. if test -f "$SEARX_BG_FILE"; then
  36. echo "Setting Searx background image"
  37. rm $SEARX_BG_FILE
  38. cp $SEARX_BASEDIR$date.jpg $SEARX_BG_FILE
  39. fi
  40. # Then grab our APOD image and store it for now
  41. #Change directory to where the script resides.
  42. #BASEDIR="$HOME/var/inbox/apod_photos"
  43. #cd $BASEDIR
  44. ########################
  45. #
  46. ## Get the APoD image from NASA
  47. #img="$(curl https://api.nasa.gov/planetary/apod\?api_key=AdfgdnmmInYgpDMEq3ShMLKjJ7DZ7jyUcgLHWdgw | jq .hdurl | tr -d \")"
  48. #
  49. ##check to see if there is any wallpaper to download
  50. #if [ -n "$img" ]
  51. #then
  52. # img_file=`echo $img | cut -d/ -f 7 | tr -d \"`
  53. # curl $img > $img_file
  54. # #set the current image as wallpaper
  55. # #hsetroot -sane $BASEDIR/$img_file
  56. # ##link slim background to new image
  57. # #rm /usr/share/slim/themes/default/background.jpg
  58. # #ln -s $BASEDIR/$img_file /usr/share/slim/themes/default/background.jpg
  59. #else
  60. # echo "No Wallpaper today"
  61. #fi