1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-26 22:10:06 +00:00

Merge branch 'next' of https://github.com/Darkheir/powerlevel9k into Darkheir-next

This commit is contained in:
Ben Hilburn 2017-03-14 14:29:02 -07:00
commit d6e708b221

View file

@ -903,15 +903,17 @@ prompt_ram() {
local base='' local base=''
local ramfree=0 local ramfree=0
if [[ "$OS" == "OSX" ]]; then if [[ "$OS" == "OSX" ]]; then
# Available = Free + Inactive
# See https://support.apple.com/en-us/HT201538
ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+') ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+')
ramfree=$((ramfree + $(vm_stat | grep "Pages inactive" | grep -o -E '[0-9]+')))
# Convert pages into Bytes # Convert pages into Bytes
ramfree=$(( ramfree * 4096 )) ramfree=$(( ramfree * 4096 ))
else else
if [[ "$OS" == "BSD" ]]; then if [[ "$OS" == "BSD" ]]; then
ramfree=$(vmstat | grep -E '([0-9]+\w+)+' | awk '{print $5}') ramfree=$(grep 'avail memory' /var/run/dmesg.boot | awk '{print $4}')
base='M'
else else
ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") ramfree=$(grep -o -E "MemAvailable:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*")
base='K' base='K'
fi fi
fi fi