From 3531f603e6ce5920b22532c34534863d5a145105 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 4 Mar 2019 17:12:49 +0100 Subject: display remaining battery time Signed-off-by: Florian Pritz --- .i3/conky-wrapper.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to '.i3') 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); } -- cgit v1.2.3-24-g4f1b