diff options
-rwxr-xr-x | .i3/conky-wrapper.pl | 5 |
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); } |