Fixed an issue where the battery percentage text was sometimes shown when it shouldn't have been

This commit is contained in:
Leon Styhre 2025-02-26 18:14:27 +01:00
parent dd8177a8c2
commit 331a33be74

View file

@ -120,7 +120,9 @@ void SystemStatusComponent::updateGrid()
} }
} }
if (mHasBattery && mBatteryText) { if (mHasBattery && mBatteryText &&
std::find(mDisplayEntries.cbegin(), mDisplayEntries.cend(), "battery") !=
mDisplayEntries.cend()) {
// We set the initial value to "100%" to calculate the cell size based on this, as this // We set the initial value to "100%" to calculate the cell size based on this, as this
// will be the longest text that will ever be displayed for the battery capacity. // will be the longest text that will ever be displayed for the battery capacity.
mBatteryPercentage = std::make_shared<TextComponent>( mBatteryPercentage = std::make_shared<TextComponent>(