--- a/status-mem/mem.c Fri Feb 27 19:46:25 2015 +0400
+++ b/status-mem/mem.c Mon Oct 17 14:23:58 2016 +0400
@@ -22,6 +22,7 @@
int free = 0;
int total = 0;
+ int avail = -1;
int sub;
while (!feof(fd)) {
if (fgets(line, sizeof(line)-1, fd) == NULL)
@@ -33,6 +34,11 @@
if (!strncmp(line, "MemFree", 7))
sscanf(line+8, "%*[ ]%d%*[^\n]", &free);
+ if (!strncmp(line, "MemAvailable", 12)) {
+ sscanf(line+13, "%*[ ]%d%*[^\n]", &sub);
+ avail = sub;
+ }
+
if (!strncmp(line, "Buffers", 7)) {
sscanf(line+8, "%*[ ]%d%*[^\n]", &sub);
free += sub;
@@ -43,7 +49,7 @@
}
}
fclose(fd);
-
+ if (avail != -1) free = avail;
int used = total - free;
#ifdef PANGO_MARKUP