mirror of
https://github.com/aminnairi/dotfiles.git
synced 2026-09-14 18:02:13 +02:00
changed the way memory gets computed
This commit is contained in:
@@ -173,11 +173,11 @@ const getVolume = async () => {
|
|||||||
|
|
||||||
const getMemory = async () => {
|
const getMemory = async () => {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
execute("/usr/bin/cat /proc/meminfo | grep MemTotal | cut -d ' ' -f 8"),
|
execute("grep MemTotal /proc/meminfo | cut -d ' ' -f 8"),
|
||||||
execute("/usr/bin/cat /proc/meminfo | grep MemFree | cut -d ' ' -f 10")
|
execute("grep MemAvailable /proc/meminfo | cut -d ' ' -f 5")
|
||||||
]).then(([rawTotalMemory, rawFreeMemory]) => {
|
]).then(([rawTotalMemory, rawAvailableMemory]) => {
|
||||||
const totalMemory = Math.round((Number(rawTotalMemory.trim()) || 0) / 100000) / 10;
|
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`;
|
return ` ${freeMemory}Go / ${totalMemory}Go`;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user