Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
neofetch: Use MemAvailable for memory on Linux if supported. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Nov 3, 2020
1 parent 4660ae7 commit 106a53c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion neofetch
Expand Up @@ -2568,10 +2568,21 @@ get_memory() {
"MemFree" | "Buffers" | "Cached" | "SReclaimable")
mem_used="$((mem_used-=${b/kB}))"
;;

# Available since Linux 3.14rc (34e431b0ae398fc54ea69ff85ec700722c9da773).
# If detected this will be used over the above calculation for mem_used.
"MemAvailable")
mem_avail=${b/kB}
;;
esac
done < /proc/meminfo

mem_used="$((mem_used / 1024))"
if [[ $mem_avail ]]; then
mem_used=$(((mem_total - mem_avail) / 1024))
else
mem_used="$((mem_used / 1024))"
fi

mem_total="$((mem_total / 1024))"
;;

Expand Down

0 comments on commit 106a53c

Please sign in to comment.