Posted By

ksaver on 07/04/11


Tagged

wallpaper


Versions (?)

Shiftwallpaper.sh: shift wallpaper every n seconds.


 / Published in: Bash
 

URL: http://pastebin.com/itGaLPti

I turned an obsolete laptop in a kind of digital frame :-)

  1. #!/usr/bin/env bash
  2. # shiftwallpaper.sh
  3. # A very simple bash script to shift wallpaper every n seconds.
  4. # Turns your desktop in a kind of digital frame :-)
  5. # Tested in and for Fluxbox [TM].
  6. # Public Domain Code. No Warranty at all.
  7. # ksaver, July 2011.
  8.  
  9. # Modify this line to you own wallpapers directory.
  10. WALLPAPER_DIR="$HOME/MyPictures/Wallpaper"
  11.  
  12. # Set interval in seconds to shift wallpaper.
  13. WAIT=120
  14.  
  15. function load_wallpapers()
  16. {
  17. # Load the wallpaper list into an array
  18. # loads new wallpapers added to directory in runtime.
  19. n=0
  20. for wallpaper in "$1/*"; do
  21. wallpaper_list[n]=$wallpaper
  22. let n=$n+1
  23. done
  24. }
  25.  
  26. function rotate_wallpapers()
  27. {
  28. # Rotate wallpaper every n seconds.
  29. for wallpaper in ${wallpaper_list[@]}; do
  30. /usr/bin/env fbsetbg -F $wallpaper
  31. sleep $1
  32. done
  33. }
  34.  
  35. ## main()
  36. while [ True ]; do
  37. load_wallpapers $WALLPAPER_DIR
  38. rotate_wallpapers $WAIT
  39. done

Report this snippet  

You need to login to post a comment.