aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-03-02 14:09:48 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-03-02 14:09:48 +0300
commite54b52ad2638de2b332ad59dc41e7f6cff271c2c (patch)
treeeff0344f4acd0d0a7daf329cd3e94a342f06c25b
parent0fc12036280d35d7169e0964429a736f7ee89f40 (diff)
fix how jobs are counted
-rwxr-xr-xpowerlevel9k.zsh-theme13
1 files changed, 5 insertions, 8 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index ff92664d..23f2169c 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -405,21 +405,18 @@ prompt_aws_eb_env() {
set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true
set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS false
prompt_background_jobs() {
- local job_lines=("${(@f)$(jobs -lr)}")
- [[ ${(c)#job_lines} == 0 ]] && return
-
- local num_jobs=$#job_lines
- local cache_key="$0 $num_jobs"
+ local n && n="${(fw)#$(jobs -rd)}" && ((n > 1)) || return
+ (( n /= 2 ))
+ local cache_key="$0 $n"
if ! _p9k_cache_get $cache_key; then
if [[ "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE" == "true" &&
- ("$num_jobs" -gt 1 || "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS" == "true") ]]; then
- _p9k_cache_set $cache_key $num_jobs
+ ("$n" -gt 1 || "$POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS" == "true") ]]; then
+ _p9k_cache_set $cache_key $n
else
_p9k_cache_set $cache_key ''
fi
fi
-
"$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "$_P9K_RETVAL" 'BACKGROUND_JOBS_ICON'
}