Tag Archives: X

shufflepaper – ‘wallpapershuffler’

What started out as a little script turned into a neat little daemon today. I’ve decided to start shuffling my wallpapers, because one my screens has developed “LCD image persistance”. While it’s a pretty mild problem (it only happens if bright whites are left on the screen for many hours, and fades after 10-20 minutes), I figured shuffling my wallpapers wouldn’t be to much of a bad idea.

I used a handy little Perl module I’ve never come across before called Proc::Daemon by Detlef Pilzecker. It really makes turning a Perl script into a daemon very easy. Here is the relevant snippet from shufflepaper. It’s pretty self-explanatory, so I won’t explain it that much.

my $daemon = Proc::Daemon->new(
   child_STDERR => '/tmp/shufflepaper.dbg',
   pid_file => '/tmp/shufflepaper.pid' );
 
if (defined $opt{s}) {
   print "stopping shufflepaper.\n";
   $daemon->Kill_Daemon();
   exit 0;
}
 
if ($daemon->Status() ne 0) {
   print "shufflepaper is already running!\n";
   exit 0;
}
 
$daemon->Init() if $fork;

I made a symlink to shufflepaper in ~/bin, and added “shufflepaper -w /mnt/data/gfx/wallpapers” to .xinitrc, and then made my WM execute “shufflepaper -n” if I press Ctrl+Alt+n (to pick another random wall). Works pretty well.

The source can be found here.

walld

A wallpaper daemon to switch wallpapers every 200 seconds. Nothing special. Have fun.

#!/usr/bin/perl
 
while(1) {
	my @walls = <~/gfx/wallpapers/*>;
	my $s = scalar @walls;
 
	my $f = @walls[rand($s)];
	print "Setting wallpaper -> $f\n";
	system("fbsetbg -a $f");
 
	sleep(200);
}
exit(0);