mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-13 22:52:30 +02:00
Added option to calculate battery percentage as total_energy * 100 / total_energy_full
This commit is contained in:
@ -533,6 +533,13 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle weighted-average
|
||||||
|
if ((config_["weighted-average"].isBool() ? config_["weighted-average"].asBool() : false) &&
|
||||||
|
total_energy_exists && total_energy_full_exists) {
|
||||||
|
if (total_energy_full > 0.0f)
|
||||||
|
calculated_capacity = ((float)total_energy * 100.0f / (float)total_energy_full);
|
||||||
|
}
|
||||||
|
|
||||||
// Handle design-capacity
|
// Handle design-capacity
|
||||||
if ((config_["design-capacity"].isBool() ? config_["design-capacity"].asBool() : false) &&
|
if ((config_["design-capacity"].isBool() ? config_["design-capacity"].asBool() : false) &&
|
||||||
total_energy_exists && total_energy_full_design_exists) {
|
total_energy_exists && total_energy_full_design_exists) {
|
||||||
|
Reference in New Issue
Block a user