Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Hint followup from submitter' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Hint followup from submitter
Authored by: darndog on Sep 28, '04 07:26:14AM
I Love it, modded it a little for my dual screen with left / right images from mandolux.com also made the warn image come up for minute averages over 5.0, load image still uses 5 min averages, unfamiliar with perl hence the lack of a decent if then else structure but it all works fine.
required files l-normal, l-load, l-warn, r-normal, r-load, r-warn, 'Left' and 'Right' folders for the active images.

My desktop (Elaine dual screen clouds from above site), now becomes overcast under load and downright threatening when under stress ;)
The load image works so much better for nightime use that I'm thinking of setting another cron job to switch that to the default after sun down by switching out the activate.pl file.


#!/usr/bin/perl

chomp(my $basedir = `dirname "$0"`);
chdir $basedir;

my $load_threshold = 1.9;
my $warn_threshold = 5.0;

if(($_ = `w`) && /load averages: +([\d\.]+) +([\d\.]+) +([\d\.]+)/) {
  if($2 <= $load_threshold) {
    $active_image_r = 'r-normal.jpg';
    $active_image_l = 'l-normal.jpg';
  }
  if($2 > $load_threshold) {
    $active_image_r = 'r-load.jpg';
    $active_image_l = 'l-load.jpg';
  }
  if($1 > $warn_threshold) {
    $active_image_r = 'r-warn.jpg';
    $active_image_l = 'l-warn.jpg';
  }

}

unlink("Right/active_a.jpg");
unlink("Right/active_b.jpg");
link($active_image_r, "Right/active_a.jpg");
link($active_image_r, "Right/active_b.jpg");
unlink("Left/active_a.jpg");
unlink("Left/active_b.jpg");
link($active_image_l, "Left/active_a.jpg");
link($active_image_l, "Left/active_b.jpg");
next job is to mod this for my laptop and use osascript to change the single desktop image rather than rotating the desktop.

[ Reply to This | # ]