Only show power levels for battery powered things

This commit is contained in:
Bill Thiede 2024-08-27 11:31:33 -07:00
parent b9935c991f
commit b124148b0b

View File

@ -58,6 +58,14 @@ impl PowerSupply {
})
})
.collect::<Result<_, _>>()?;
// Skip things that aren't battery powered
if !values
.get("POWER_SUPPLY_TYPE")
.map(|t| t == &"Battery")
.unwrap_or(false)
{
continue;
}
let cap: u32 = values
.get("POWER_SUPPLY_CAPACITY")
.unwrap_or(&"0")