App-wmiirc
view release on metacpan or search on metacpan
lib/App/wmiirc/Battery.pm view on Meta::CPAN
my $minutes_to_full = $power_now ? ($self->_bat("energy_full")
- $self->_bat("energy_now"))
/ $power_now * 60
: -1;
my %data = (
time_full => strftime("%-H:%M", 0, $minutes_to_full, 0, 0, 0, 0),
# Let me know if your battery lasts for >23 hours. I'd like one too.
time_empty => strftime("%-H:%M", 0, $minutes, 0, 0, 0, 0),
watts => sprintf("%d", $power_now / 1e6),
percent => sprintf("%d", $self->_bat("energy_now") /
$self->_bat("energy_full") * 100),
);
given($self->_bat("status")) {
when("Discharging") {
if($minutes <= $config{warn_minutes}) {
$self->core->dispatch("event_msg", "Battery critical");
}
if($minutes <= $config{info_minutes}) {
( run in 0.336 second using v1.01-cache-2.11-cpan-05162d3a2b1 )