Guest User

Untitled

a guest
May 7th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.90 KB | None | 0 0
  1. #!/bin/bash
  2. #================================================================================
  3. # Description
  4. #   Script to set a random wallpaper in Gnome/Unity
  5. # Synopsis
  6. #   rotate-wallpaper
  7. # Author
  8. #   Dmitry Kann, http://yktoo.com/
  9. # License
  10. #   Public domain
  11. #================================================================================
  12. # Setup vars
  13. dir_wallpapers="$HOME/Загрузки/Dropbox/Картинки/Wallpapers/"  # Path to wallpaper directory
  14.  
  15. # Fill array with picture files (replace spaces with colons to fool the array)
  16. files=( $(find "$dir_wallpapers" -type f \( -iname '*.jpeg' -o -iname '*.jpg' -o -iname '*.png' \) | sed s/' '/':'/g) )
  17. # Get number of members in the array
  18. N=${#files[@]}
  19. # Randomize N
  20. ((N=RANDOM%N))
  21. # Get the normal file name (change colons back to spaces)
  22. file=${files[$N]//:/ }
  23. # Change desktop wallpaper
  24. gsettings set org.gnome.desktop.background picture-uri "file://$file"
Advertisement
Add Comment
Please, Sign In to add comment