changepaper 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. feh --bg-fill $BASEDIR/$date.jpg
  27. #link slim background to new image
  28. SLIM_BG_FILE=/usr/share/slim/themes/default/background.jpg
  29. echo "Setting Slim background image"
  30. rm $SLIM_BG_FILE
  31. cp $BASEDIR/$date.jpg $SLIM_BG_FILE
  32. #SEARX_BG_FILE=/usr/local/src/searx/searx/static/themes/oscar/img/bg.jpg
  33. #echo "Setting Searx background image"
  34. #scp $BASEDIR/$date.jpg search.local:$SEARX_BG_FILE
  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