diff --git a/kfetch b/kfetch deleted file mode 100755 index 42bda44..0000000 Binary files a/kfetch and /dev/null differ diff --git a/src/fetch.c b/src/fetch.c index 13665cc..194da6b 100644 --- a/src/fetch.c +++ b/src/fetch.c @@ -186,19 +186,20 @@ int GetMem(const char *title, const FETCH fetch) { if (fp == NULL) return 1; - off_t free = 0, total = 0; - if (fscanf(fp, "MemTotal: %lu kB\nMemFree: %lu kB", &total, &free) < 0) + off_t free = 0, total = 0, cached = 0, buffer = 0, unused = 0; + if (fscanf(fp, "MemTotal: %lu kB\nMemFree: %lu kB\nMemAvailable: %lu kB\nBuffers: %lu kB\nCached: %lu kB", &total, &free, &unused, &buffer, &cached) < 0) return 1; fclose(fp); + off_t used = (total - (cached + free + buffer)) / 1024; #ifdef PRINT_USED_AND_TOTAL_MEM - printf("%s%s%s%lumb / %lumb", fetch.color, title, fetch.font_color, (uintmax_t)(total - free) / 1024, (uintmax_t)total / 1024); + printf("%s%s%s%lumb / %lumb", fetch.color, title, fetch.font_color, (uintmax_t)used, (uintmax_t)total / 1024); #elif PRINT_TOTALMEM printf("%s%s%s%lumb", fetch.color, title, fetch.font_color, (uintmax_t)total / 1024); #else - printf("%s%s%s%lumb", fetch.color, title, fetch.font_color, (uintmax_t)(total - free) / 1024); + printf("%s%s%s%lumb", fetch.color, title, fetch.font_color, (uintmax_t)used); #endif