batteries: hide % if more than 3 devices

This commit is contained in:
galister
2026-01-07 02:42:05 +09:00
parent 0f89321070
commit 8160d20e73

View File

@@ -164,7 +164,9 @@ fn battery_on_tick(
&& let Some(soc) = device.soc && let Some(soc) = device.soc
{ {
let soc = (soc * 100.).min(99.) as u32; let soc = (soc * 100.).min(99.) as u32;
let text = format!("{soc}%"); let num_devices = app.input_state.devices.len();
let suffix = if num_devices > 3 { "" } else { "%" };
let text = format!("{soc}{suffix}");
let color = if device.charging { let color = if device.charging {
state.charging_color state.charging_color
} else if soc < state.low_threshold { } else if soc < state.low_threshold {