From df0d34dbd46d6e8dbccd981b0a51ec9867168f61 Mon Sep 17 00:00:00 2001 From: Alexander Kobel Date: Tue, 21 Apr 2020 00:53:36 +0200 Subject: [PATCH] Fix round to 0 or 1 in capacity computation with given full-at --- src/modules/battery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index bad3355b..6e86eaf4 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -119,7 +119,7 @@ const std::tuple waybar::modules::Battery::getInfos if (config_["full-at"].isUInt()) { auto full_at = config_["full-at"].asUInt(); if (full_at < 100) { - capacity = static_cast(capacity / full_at) * 100; + capacity = 100.f * capacity / full_at; if (capacity > full_at) { capacity = full_at; }