From a4b1b0a211ac3f601cdaafb1a560319246cd14b0 Mon Sep 17 00:00:00 2001 From: PolpOnline Date: Fri, 13 Jan 2023 22:39:59 +0100 Subject: [PATCH] modules/custom: Added percentage rounding --- src/modules/custom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index 23dba38..39d93d4 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -209,8 +209,8 @@ void waybar::modules::Custom::parseOutputJson() { class_.push_back(c.asString()); } } - if (!parsed["percentage"].asString().empty() && parsed["percentage"].isUInt()) { - percentage_ = parsed["percentage"].asUInt(); + if (!parsed["percentage"].asString().empty() && parsed["percentage"].isNumeric()) { + percentage_ = (int) lround(parsed["percentage"].asFloat()); } else { percentage_ = 0; }