summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2019-03-04 17:12:49 +0100
committerFlorian Pritz <bluewind@xinu.at>2019-03-27 15:23:13 +0100
commit3531f603e6ce5920b22532c34534863d5a145105 (patch)
treec8d4ee102ef907c97db2d35c4d697ed910cfcb85
parentf7fddaad6c34f01996a2bb93d16f3b1e44fadb9f (diff)
downloaddotfiles-3531f603e6ce5920b22532c34534863d5a145105.tar.gz
dotfiles-3531f603e6ce5920b22532c34534863d5a145105.tar.xz
display remaining battery time
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x.i3/conky-wrapper.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/.i3/conky-wrapper.pl b/.i3/conky-wrapper.pl
index 7e3dedd..687762b 100755
--- a/.i3/conky-wrapper.pl
+++ b/.i3/conky-wrapper.pl
@@ -92,5 +92,8 @@ sub get_bat_stats {
}
close $fh;
- return sprintf("%s %s%%, %sW", $bat, $values{CAPACITY}, $values{POWER_NOW} / 1e6);
+ my $time_remaining_hours = 0;
+ $time_remaining_hours = $values{ENERGY_NOW} / $values{POWER_NOW} unless $values{POWER_NOW} == 0;
+
+ return sprintf("%s %s%%, %.2fW, %.2fh", $bat, $values{CAPACITY}, $values{POWER_NOW} / 1e6, $time_remaining_hours);
}