Automatic wallpaper change with a personal touch.

Greetings, so long that I have not collaborated with anything on the blog (more than a comment lost there) makes me happy to be able to do so in such a beautiful change that the blog received.

Today I bring something very used and very spoken everywhere, but with a little twist.
Itself is a small script en bash entirely written by me (which I really appreciate the different posts from DesdeLinux that helped me to do it) that is simply used to change desktop background automatically every so often.

So what's new old?

Various little things. First use nitrogen, which makes it lightweight. The script causes the background to be changed in a random time. It also checks the folder and its sub-folders automatically. The best thing is that every time the background changes, it notifies you with a notification on your desktop  . And you can modify it as you like, since it is very simple.

For reasons of time I will not go around the bush explaining details that have already been explained in FromLinuxhow is it Bash or how to start a script at the beginning of the session.
Therefore I consider that you already have certain knowledge on the subject or if not, you will look for it on the blog or you will consult it.
Thanks for your understanding.

It must first be installed Nitrogen (come on, they already have to know how to do it), also optionally libnotify for notifications.

Nitrogen

NITROGEN

Without further ado, the script:

#Aquí va la carpeta con las imágenes (no importa si están en subcarpetas)
cd "~/Imágenes/Fondo Pantalla/"
#Comienzo del bucle. Como verán es infinito :)
while [ 0 -eq 0 ]; do
#Esto hace que el script:
#1 Busque todos los archivos con "find"
#2 Filtre solo los jpg con "grep jpg"
#3 Cuente cuantos archivos hay con "wc -l"
NITROGEN_CANTIDAD_DE_LINEAS=`find | grep jpg | wc -l`
#Me imagino que sabrán para que sirve esta linea ¬¬
echo "lineas $NITROGEN_CANTIDAD_DE_LINEAS"
#Esta linea elige un numero al azar con min. 1 y máx. el numero de archivos ya obtenido
NITROGEN_ELEGIR=$((1+RANDOM%$NITROGEN_CANTIDAD_DE_LINEAS))
echo "linea elegida: $NITROGEN_ELEGIR"
#Esto hace que el script:
#1 Busque todos los archivos con "find"
#2 Filtre solo los jpg con "grep jp"
#3 Seleccione la linea con "sed" usando la linea elegida anteriormente.
NITROGEN_WALLPAPER=`find | grep jpg | sed -n $((NITROGEN_ELEGIR))p`
echo $NITROGEN_WALLPAPER
#Por fin establecemos el fondo con el archivo elegido.
nitrogen --set-centered $NITROGEN_WALLPAPER
#Con esta linea elegimos un tiempo al azar con min. 4 y máx 120.
NITROGEN_TIEMPO=$((4+RANDOM%120))
#Esto envía una notificación al escritorio.
#Con la opción -i pueden elegir un icono.
#Y obvio que pueden cambiar el texto o eliminar si molesta con solo borrar/comentar la linea.
notify-send -t 10000 "CAMBIO DE FONDO DE ESCRITORIO" "\nEl fondo de pantalla a sido cambiado.\nEl próximo cambio se efectuara en $NITROGEN_TIEMPO segundos.\n\nEl misterioso cambiador de imágenes"
#Con esto esperamos el tiempo en segundos ya elegido antes.
sleep $((NITROGEN_TIEMPO))
#Aquí termina todo para volver a comenzar
done

Obviously that in the line you use "CD" they must place the path where they have their images.

Don't forget to make the file executable !!!

All that remains is to do it start automatically (although I advise trying it in a terminal) in your favorite environment.

How can you see I have very little desire to write, ha.

But I leave you to try it, especially it will be good for those who use a minimalist environment.

It is also quite educational, because it uses loops, variables, etc.
Hope you like!!!!
REGARDS!!!!!