modules/custom: Added percentage rounding

This commit is contained in:
PolpOnline 2023-01-13 22:39:59 +01:00
parent 6c8e186586
commit a4b1b0a211
No known key found for this signature in database
GPG Key ID: 322025BD616C3FED
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}