diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2016-10-26 18:17:47 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2016-10-26 18:17:47 +0300 |
commit | 11fcb5684b3b777ebfeb01edc4b985951c8f04a6 (patch) | |
tree | 696d5d1315f58d72953c5570d61df8beb0b10082 | |
parent | 3326353b108122bee2259ea224e20dca59e47a4e (diff) | |
parent | 3c92cf9748cff350a14cc8f42eda439c5fe01baa (diff) |
Merge branch 'master' into next
-rwxr-xr-x | powerlevel9k.zsh-theme | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 0860cff4..87678149 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -590,9 +590,13 @@ prompt_load() { 'normal' 'green' ) - if [[ "$OS" == "OSX" ]]; then + if [[ "$OS" == "OSX" ]] || [[ "$OS" == "BSD" ]]; then load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1) - cores=$(sysctl -n hw.logicalcpu) + if [[ "$OS" == "OSX" ]]; then + cores=$(sysctl -n hw.logicalcpu) + else + cores=$(sysctl -n hw.ncpu) + fi else load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1) cores=$(nproc) @@ -665,8 +669,13 @@ prompt_ram() { # Convert pages into Bytes ramfree=$(( ramfree * 4096 )) else - ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") - base='K' + if [[ "$OS" == "BSD" ]]; then + ramfree=$(vmstat | grep -E '([0-9]+\w+)+' | awk '{print $5}') + base='M' + else + ramfree=$(grep -o -E "MemFree:\s+[0-9]+" /proc/meminfo | grep -o "[0-9]*") + base='K' + fi fi "$1_prompt_segment" "$0" "$2" "yellow" "$DEFAULT_COLOR" "$(printSizeHumanReadable "$ramfree" $base)" 'RAM_ICON' |