changepaper.sh 1.9 KB

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