diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2017-03-15 00:29:02 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2017-03-15 00:29:02 +0300 |
commit | d6e708b221ce8ec06409f9d29389d4e081f54d32 (patch) | |
tree | fd213621fbfc95761778400252c8b3b9c4c392ce | |
parent | 3ad77e6d6d3ddd2e541318a6df46021d4bff4551 (diff) | |
parent | 8be5fb62e44b22faf75ac890e6f1b37e94997cb2 (diff) |
Merge branch 'next' of https://github.com/Darkheir/powerlevel9k into Darkheir-next
-rwxr-xr-x | powerlevel9k.zsh-theme | 8 |
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 |