Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use feature qw { switch };
- my $user = getlogin();
- my $folder = "/Imagenes/" ;# El folder de tus imagenes(no es necesario poner tu nombre de usuario)
- my $dir = "/home/" . $user . $folder;
- my (@archivos,@imagenes) = ((),());
- my $time = 60; # Tiempo entre cada wallpaper
- =pod
- Eso es todo ahora entra en accion el script
- Para saber como funciona date una vuelta por los tutoriales de Tiempo de Tux sobre perl
- http://www.itimetux.com
- =cut
- opendir(my $recorrer, $dir) || die "Error :( $! \n";
- while(readdir $recorrer) {
- if (-f $dir . "/" . $_) {
- push (@archivos,$_);
- }
- }
- closedir $recorrer;
- if (scalar(@archivos) == 0 ) {
- print "No se encontraron archivos en $dir\n";
- exit;
- }
- foreach my $files(@archivos) {
- given ($files) {
- when(/.*jpeg/)
- {
- push (@imagenes,$files);
- }
- when(/.*png/)
- {
- push (@imagenes,$files);
- }
- when(/.*jpg/)
- {
- push (@imagenes,$files);
- }
- default
- {
- undef;
- }
- }
- }
- if (scalar(@imagenes) > 1 ) {
- while (1) {
- foreach my $files(sort(@imagenes)) {
- #print "$files\n"; # Para desarrollo
- `feh --bg-scale "$dir$files"`;
- sleep($time);
- }
- }
- }
- else {
- print "No se encontraron imagenes en $dir\n";
- }
- =head LICENSE
- This library is free software; you can redistribute it and/or modify it under
- the terms of the GNU Library General Public License as published by the Free
- Software Foundation; either version 2.1 of the License, or (at your option) any
- later version.
- =cut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement