You are not logged in.
Pages: 1
Hi, I wanted a script that changes my wallpaper randomly, here it is in Perl. I have this run every 30 minutes with a cron job. Kind of nice since I have so many wallpapers but never really use any of them.
#!/usr/bin/perl -w
#randomly change my wallpaper.
#by F.
use warnings;
use strict;
opendir(DIR, "/path/to/wallpaper/directory") || die "can't open directory: $!";
my @files = grep { $_ ne '.' and $_ ne '..' } readdir(DIR);
closedir DIR;
# perldoc -q "random element"
my $chosenwp = $files[rand @files];
#print "chosen wallpaper is: $chosenwp\n";
system("feh --bg-scale /path/to/wallpaper/directory/$chosenwp");
If anyone can play golf on this please let me know!
Offline
f, you may wanna check out the wallapaper changer on xterminus' site. ive never used it but from what ive read about it it is very feature rich. maybe you can pop some ideas off his project as well.
archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson
Offline
Pages: 1