aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2017-03-15 00:30:19 +0300
committerBen Hilburn <bhilburn@gmail.com>2017-03-15 00:30:19 +0300
commitec50da4ac5c34046fea46d1e9eb0bebbfd21d01d (patch)
treefd213621fbfc95761778400252c8b3b9c4c392ce
parent3ad77e6d6d3ddd2e541318a6df46021d4bff4551 (diff)
parentd6e708b221ce8ec06409f9d29389d4e081f54d32 (diff)
Merge branch 'Darkheir-next' into next
-rwxr-xr-xpowerlevel9k.zsh-theme8
1 files changed, 5 insertions, 3 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index f8367e85..52b56f4e 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -903,15 +903,17 @@ prompt_ram() {
local base=''
local ramfree=0
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=$((ramfree + $(vm_stat | grep "Pages inactive" | grep -o -E '[0-9]+')))
# Convert pages into Bytes
ramfree=$(( ramfree * 4096 ))
else
if [[ "$OS" == "BSD" ]]; then
- ramfree=$(vmstat | grep -E '([0-9]+\w+)+' | awk '{print $5}')
- base='M'
+ ramfree=$(grep 'avail memory' /var/run/dmesg.boot | awk '{print $4}')
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'
fi
fi