aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2015-08-31 19:13:28 +0300
committerDominik Ritter <dritter03@googlemail.com>2015-08-31 19:13:28 +0300
commitae77fc17d84255aa134bf882959aa4b32eaf5913 (patch)
tree0744bf6ac09d7ec37bc949e89429b0bfb74f62f0 /powerlevel9k.zsh-theme
parent815582ffe0a73d7cb1bb445034c2ffa13814b9ae (diff)
Under OSX the output of `sysctl vm.loadavg` may be localized. With german locale it will print an comma as separator..
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rw-r--r--powerlevel9k.zsh-theme5
1 files changed, 4 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 5065a6fb..c0819d74 100644
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -613,7 +613,7 @@ prompt_ip() {
prompt_load() {
if [[ "$OS" == "OSX" ]]; then
- load_avg_5min=$(sysctl vm.loadavg | grep -o -E '[0-9]+\.[0-9]+' | head -n 1)
+ load_avg_5min=$(sysctl vm.loadavg | grep -o -E '[0-9]+(\.|,)[0-9]+' | head -n 1)
ramfree=$(vm_stat | grep "Pages free" | grep -o -E '[0-9]+')
# Convert pages into Bytes
ramfree=$(( $ramfree * 4096 ))
@@ -624,6 +624,9 @@ prompt_load() {
base=K
fi
+ # Replace comma
+ load_avg_5min=${load_avg_5min//,/.}
+
if [[ "$load_avg_5min" -gt 10 ]]; then
BACKGROUND_COLOR="red"
FUNCTION_SUFFIX="_CRITICAL"