Merge pull request #236 from dylanaraps/memavail
[Linux / Windows] Memory: Use memavail when available.
This commit is contained in:
commit
5c562a751c
1 changed files with 8 additions and 2 deletions
10
neofetch
10
neofetch
|
@ -1212,8 +1212,14 @@ getgpu () {
|
||||||
getmemory () {
|
getmemory () {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Linux" | "Windows")
|
"Linux" | "Windows")
|
||||||
mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo) 0 0)
|
if [ ! -z "$(grep -F "MemAvail" /proc/meminfo)" ]; then
|
||||||
memused=$((mem[0] - mem[1] - mem[2] - mem[3]))
|
mem=($(awk -F ':| kB' '/MemTotal|MemAvail/ {printf $2}' /proc/meminfo))
|
||||||
|
memused=$((mem[0] - mem[1]))
|
||||||
|
else
|
||||||
|
mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo) 0 0)
|
||||||
|
memused=$((mem[0] - mem[1] - mem[2] - mem[3]))
|
||||||
|
fi
|
||||||
|
|
||||||
memused=$((memused / 1024))
|
memused=$((memused / 1024))
|
||||||
memtotal=$((mem[0] / 1024))
|
memtotal=$((mem[0] / 1024))
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue