thide battery string entirely - spoon - [fork] customized build of spoon, the d… | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4619eab788eeec77c9eae7d7b5abf248f724c3de | |
parent 694c695730115e84ad356c805bc3bbc32f49cf8b | |
Author: Anders Damsgaard <[email protected]> | |
Date: Fri, 8 Jan 2021 18:26:23 +0100 | |
hide battery string entirely | |
Diffstat: | |
M batt.c | 8 +++++--- | |
M config.h | 2 +- | |
2 files changed, 6 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/batt.c b/batt.c | |
t@@ -17,9 +17,9 @@ battprint(char *buf, size_t len, int acon, int life, int rem… | |
c = acon ? '=' : ' '; | |
if (c == ' ' && remain != 0) | |
- snprintf(buf, len, "%d%% %d:%02d", life, remain/60, remain%60); | |
+ snprintf(buf, len, "%d%% %d:%02d |", life, remain/60, remain%6… | |
else | |
- snprintf(buf, len, "%d%%", life); | |
+ snprintf(buf, len, " %d%% |", life); | |
} | |
t@@ -50,7 +50,9 @@ battread(void *arg, char *buf, size_t len) | |
} | |
close(fd); | |
- if (info.battery_state != APM_BATTERY_ABSENT) | |
+ if (info.battery_state == APM_BATTERY_ABSENT) | |
+ snprintf(buf, len, ""); | |
+ else | |
battprint(buf, len, info.ac_state == APM_AC_ON, | |
info.battery_life, info.minutes_left); | |
return 0; | |
diff --git a/config.h b/config.h | |
t@@ -15,7 +15,7 @@ struct ent ents[] = { | |
/*{ .fmt = "[%s] ", .read = cpuread, .arg = "/sys/device… | |
{ .fmt = " %s°C", .read = tempread, .arg = "/sys/class/… | |
{ .fmt = " %s "SEP, .read = loadread, .arg = NULL }, | |
- { .fmt = " %s "SEP, .read = battread, .arg = &(s… | |
+ { .fmt = "%s", .read = battread, .arg = &(struct… | |
/*{ .fmt = "%s ", .read = fileread, .arg = "/etc… | |
{ .fmt = " %s "SEP, .read = wifiread, .arg = NUL… | |
{ .fmt = " %s", .read = dateread, .arg = &(struc… |