summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid McKay <david@rawkode.com>2016-04-25 09:08:36 +0300
committerDavid McKay <david@rawkode.com>2016-04-25 09:08:36 +0300
commitd2728f0dd1fd301f6de2250053485553673aafd3 (patch)
tree6c726a2e61c3f8d8d4ac3039e4e38d5306887035
parent78b4ab0414eb1c3b69a1fd9eae60f520e7fc79d2 (diff)
Consolidated if statements and fixed OSX cpu cores command
-rwxr-xr-xpowerlevel9k.zsh-theme8
1 files changed, 2 insertions, 6 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 4fd7ecf4..0f321bc3 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -580,12 +580,6 @@ prompt_load() {
local current_state="unknown"
local cores
- if [[ "$OS" == "OSX" ]]; then
- cores=$(sysctl -a | grep machdep.cpu)
- else
- cores=$(nproc)
- fi
-
typeset -AH load_states
load_states=(
'critical' 'red'
@@ -595,8 +589,10 @@ prompt_load() {
if [[ "$OS" == "OSX" ]]; then
load_avg_1min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1)
+ cores=$(sysctl -n hw.physicalcpu)
else
load_avg_1min=$(grep -o "[0-9.]*" /proc/loadavg | head -n 1)
+ cores=$(nproc)
fi
# Replace comma