Make the battery full-at go to 100%

full-at was capped at the value instead of allowing the battery to show
100% when you were at the full-at value. Uncapping makes more sense as
it makes the full-at value the new 100% and the scale goes down from
there. Whereas before the battery would stay at the full-at value until
it went down enough which is unrealistic.
This commit is contained in:
Pedro Côrte-Real 2020-11-27 10:55:27 +00:00
parent f45d582957
commit 908fa2c6c2
2 changed files with 1 additions and 4 deletions

View File

@ -20,7 +20,7 @@ The *battery* module displays the current capacity and state (eg. charging) of y
*full-at*: ++ *full-at*: ++
typeof: integer ++ typeof: integer ++
Define the max percentage of the battery, useful for an old battery, e.g. 96 Define the max percentage of the battery, for when you've set the battery to stop charging at a lower level to save it. For example, if you've set the battery to stop at 80% that will become the new 100%.
*interval*: ++ *interval*: ++
typeof: integer ++ typeof: integer ++

View File

@ -127,9 +127,6 @@ const std::tuple<uint8_t, float, std::string> waybar::modules::Battery::getInfos
auto full_at = config_["full-at"].asUInt(); auto full_at = config_["full-at"].asUInt();
if (full_at < 100) { if (full_at < 100) {
capacity = 100.f * capacity / full_at; capacity = 100.f * capacity / full_at;
if (capacity > full_at) {
capacity = full_at;
}
} }
} }
if (capacity > 100.f) { if (capacity > 100.f) {