Tanner Babcock

Dotfiles / battery

		#!/usr/bin/perl
my $output = qx(acpi);

my @fields = split /\,/, $output;
my $out = substr $fields[1], 1, 3;
my $perc = substr $out, 0, 2;

my $range = 100;
my $random = int(rand($range))+1;

if ($perc <= 12 && ($random % 10 == 0)) {
	qx(notify-send --expire-time=6000 --urgency=critical "<b>Low Battery</b><br /><br />Please charge your laptop now.");
}

print "$out\n";