changepaper.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/natgeo/"
  12. # Get daily NatGeo POTD
  13. python3 ~/.bin/get_natgeo_potd.py
  14. python3 ~/.bin/get_astrobin_potd.py
  15. date=$(date '+%Y-%m-%d')
  16. #set the current image as wallpaper
  17. feh --bg-scale $BASEDIR/$date.jpg
  18. #link slim background to new image
  19. rm /usr/share/slim/themes/default/background.jpg
  20. ln -s $BASEDIR/$date.jpg /usr/share/slim/themes/default/background.jpg
  21. echo "Background and slim wallpaper set using Astrobin PotD"
  22. # Then grab our APOD image and store it for now
  23. #Change directory to where the script resides.
  24. #BASEDIR="$HOME/var/inbox/apod_photos"
  25. #cd $BASEDIR
  26. ########################
  27. #
  28. ## Get the APoD image from NASA
  29. #img="$(curl https://api.nasa.gov/planetary/apod\?api_key=AdfgdnmmInYgpDMEq3ShMLKjJ7DZ7jyUcgLHWdgw | jq .hdurl | tr -d \")"
  30. #
  31. ##check to see if there is any wallpaper to download
  32. #if [ -n "$img" ]
  33. #then
  34. # img_file=`echo $img | cut -d/ -f 7 | tr -d \"`
  35. # curl $img > $img_file
  36. # #set the current image as wallpaper
  37. # #feh --bg-scale $BASEDIR/$img_file
  38. # ##link slim background to new image
  39. # #rm /usr/share/slim/themes/default/background.jpg
  40. # #ln -s $BASEDIR/$img_file /usr/share/slim/themes/default/background.jpg
  41. #else
  42. # echo "No Wallpaper today"
  43. #fi