From 97025a03d40b20f45b235b377fd35366c6632aa2 Mon Sep 17 00:00:00 2001 From: aminnairi <18418459+aminnairi@users.noreply.github.com> Date: Tue, 25 Apr 2023 12:30:45 +0200 Subject: [PATCH] changed the way memory gets computed --- i3/i3status/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/i3/i3status/index.js b/i3/i3status/index.js index 092be43..010f831 100644 --- a/i3/i3status/index.js +++ b/i3/i3status/index.js @@ -173,11 +173,11 @@ const getVolume = async () => { const getMemory = async () => { return Promise.all([ - execute("/usr/bin/cat /proc/meminfo | grep MemTotal | cut -d ' ' -f 8"), - execute("/usr/bin/cat /proc/meminfo | grep MemFree | cut -d ' ' -f 10") - ]).then(([rawTotalMemory, rawFreeMemory]) => { + execute("grep MemTotal /proc/meminfo | cut -d ' ' -f 8"), + execute("grep MemAvailable /proc/meminfo | cut -d ' ' -f 5") + ]).then(([rawTotalMemory, rawAvailableMemory]) => { const totalMemory = Math.round((Number(rawTotalMemory.trim()) || 0) / 100000) / 10; - const freeMemory = Math.round((Number(rawFreeMemory.trim()) || 0) / 100000) / 10; + const freeMemory = Math.round((Number(rawAvailableMemory.trim()) || 0) / 100000) / 10; return ` ${freeMemory}Go / ${totalMemory}Go`; });