Add free memory

This commit is contained in:
ekzyis 2024-04-21 09:38:43 +02:00
parent 46f35713b6
commit 0a69e941d5
1 changed files with 4 additions and 1 deletions

View File

@ -218,6 +218,7 @@ main(void)
int t1; int t1;
char *kbmap; char *kbmap;
char *surfs; char *surfs;
char *freeMem;
if (!(dpy = XOpenDisplay(NULL))) { if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "dwmstatus: cannot open display.\n"); fprintf(stderr, "dwmstatus: cannot open display.\n");
@ -234,8 +235,9 @@ main(void)
// surfs = execscript("surf-status"); // surfs = execscript("surf-status");
t0 = gettemperature("/sys/devices/virtual/thermal/thermal_zone0", "temp"); t0 = gettemperature("/sys/devices/virtual/thermal/thermal_zone0", "temp");
t1 = gettemperature("/sys/devices/virtual/thermal/thermal_zone1", "temp"); t1 = gettemperature("/sys/devices/virtual/thermal/thermal_zone1", "temp");
freeMem = execscript("free -m | grep Mem | awk '{ print $3 }'");
status = smprintf("| T%d°C | L%s | B%s | %s |", t0 > t1 ? t0 : t1, avgs, bat, tmbln); status = smprintf("| T%d°C | L%s | %sM | B%s | %s |", t0 > t1 ? t0 : t1, avgs, freeMem, bat, tmbln);
setstatus(status); setstatus(status);
// free(surfs); // free(surfs);
@ -248,6 +250,7 @@ main(void)
// free(tmutc); // free(tmutc);
free(tmbln); free(tmbln);
free(status); free(status);
free(freeMem);
} }
XCloseDisplay(dpy); XCloseDisplay(dpy);