gnome-changepaper 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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='bing'
  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. ~/.asdf/installs/python/3.11.4/bin/python ~/.bin/get_bing_potd.py
  23. date=$(date '+%Y-%m-%d')
  24. #set the current image as wallpaper
  25. echo "Setting desktop background"
  26. gsettings set org.gnome.desktop.background picture-uri $BASEDIR/$date.jpg
  27. gsettings set org.gnome.desktop.background picture-uri-dark $BASEDIR/$date.jpg
  28. #link slim background to new image
  29. #SLIM_BG_FILE=/usr/share/slim/themes/default/background.jpg
  30. #echo "Setting Slim background image"
  31. #rm $SLIM_BG_FILE
  32. #cp $BASEDIR/$date.jpg $SLIM_BG_FILE
  33. #SEARX_BG_FILE=/usr/local/src/searx/searx/static/themes/oscar/img/bg.jpg
  34. #echo "Setting Searx background image"
  35. #scp $BASEDIR/$date.jpg search.local:$SEARX_BG_FILE
  36. # Then grab our APOD image and store it for now
  37. #Change directory to where the script resides.
  38. #BASEDIR="$HOME/var/inbox/apod_photos"
  39. #cd $BASEDIR
  40. ########################
  41. #
  42. ## Get the APoD image from NASA
  43. #img="$(curl https://api.nasa.gov/planetary/apod\?api_key=AdfgdnmmInYgpDMEq3ShMLKjJ7DZ7jyUcgLHWdgw | jq .hdurl | tr -d \")"
  44. #
  45. ##check to see if there is any wallpaper to download
  46. #if [ -n "$img" ]
  47. #then
  48. # img_file=`echo $img | cut -d/ -f 7 | tr -d \"`
  49. # curl $img > $img_file
  50. # #set the current image as wallpaper
  51. # #hsetroot -sane $BASEDIR/$img_file
  52. # ##link slim background to new image
  53. # #rm /usr/share/slim/themes/default/background.jpg
  54. # #ln -s $BASEDIR/$img_file /usr/share/slim/themes/default/background.jpg
  55. #else
  56. # echo "No Wallpaper today"
  57. #fi