Add battery

This commit is contained in:
Przemek Grondek 2022-07-15 17:56:55 +02:00
parent 1145ff4c4e
commit cb203250c5

View File

@ -182,6 +182,7 @@ main(void)
char *avgs;
char *tmbln;
char *t0, *t1;
char *bat;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n");
@ -193,13 +194,15 @@ main(void)
tmbln = mktimes("%a %d %b %H:%M %Z %Y", tzberlin);
t0 = gettemperature("/sys/class//hwmon/hwmon0", "temp1_input");
t1 = gettemperature("/sys/class//hwmon/hwmon2", "temp1_input");
bat = getbattery("/sys/class/power_supply/BAT0");
status = smprintf("Temp: %s, %s | Load: %s | %s %s",
t0, t1, avgs, tmbln);
status = smprintf("Bat: %s | Temp: %s, %s | Load: %s | %s %s",
bat, t0, t1, avgs, tmbln);
setstatus(status);
free(t0);
free(t1);
free(bat);
free(avgs);
free(tmbln);
free(status);