diff --git a/components/battery.c b/components/battery.c index f2b0f14..a36132d 100644 --- a/components/battery.c +++ b/components/battery.c @@ -53,6 +53,7 @@ { "Charging", "+" }, { "Discharging", "-" }, { "Full", "o" }, + { "Not charging", "o" }, }; size_t i; char path[PATH_MAX], state[12]; @@ -61,7 +62,7 @@ "/sys/class/power_supply/%s/status", bat) < 0) { return NULL; } - if (pscanf(path, "%12s", state) != 1) { + if (pscanf(path, "%12[a-zA-Z ]", state) != 1) { return NULL; } @@ -84,7 +85,7 @@ "/sys/class/power_supply/%s/status", bat) < 0) { return NULL; } - if (pscanf(path, "%12s", state) != 1) { + if (pscanf(path, "%12[a-zA-Z ]", state) != 1) { return NULL; }