Commit 14212f78 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Show peripheral low battery notification for NoCharge

BlueZ doesn't report charge state, only percentage, so it is unfortunately always NoCharge for them.
Add an additional guard to check for "0%" charge explicitly just in case.

Differential Revision:
parent ef856e35
......@@ -511,7 +511,12 @@ bool Core::emitBatteryChargePercentNotification(int currentPercent, int previous
if (b && !b->isPowerSupply()) {
// if you leave the device out of reach or it has not been initialized yet
// it won't be "there" and report 0%, don't show anything in this case
if (!b->isPresent() || b->chargeState() != Battery::Discharging) {
if (!b->isPresent() || b->chargePercent() == 0) {
return false;
// Bluetooth devices don't report charge state, so it's "NoCharge" in all cases for them
if (b->chargeState() != Battery::Discharging && b->chargeState() != Battery::NoCharge) {
return false;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment