From 11d00ce71316153f7cf2dabf5a40b0f24064d9e8 Mon Sep 17 00:00:00 2001 From: v1rgul Date: Mon, 18 Jan 2016 05:11:05 +0100 Subject: [PATCH 1/3] background_jobs: show number if verbose --- powerlevel9k.zsh-theme | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c8879dbc..eba94629 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -290,9 +290,15 @@ prompt_aws() { } # Segment to indicate background jobs with an icon. +set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true prompt_background_jobs() { - if [[ $(jobs -l | wc -l) -gt 0 ]]; then - "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "" 'BACKGROUND_JOBS_ICON' + local background_jobs_number=$(jobs -l | wc -l) + if [[ background_jobs_number -gt 0 ]]; then + local background_jobs_number_print="" + if [[ POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE ]] && [[ background_jobs_number -gt 1 ]]; then + background_jobs_number_print="$background_jobs_number" + fi + "$1_prompt_segment" "$0" "$2" "$DEFAULT_COLOR" "cyan" "$background_jobs_number_print" 'BACKGROUND_JOBS_ICON' fi } From 29b346930b8d214b2fe5ddd53f574883958ae70c Mon Sep 17 00:00:00 2001 From: v1rgul Date: Fri, 22 Jan 2016 01:56:43 +0100 Subject: [PATCH 2/3] fix wc glitch on OSX --- powerlevel9k.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index eba94629..f464e10e 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -292,7 +292,7 @@ prompt_aws() { # Segment to indicate background jobs with an icon. set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true prompt_background_jobs() { - local background_jobs_number=$(jobs -l | wc -l) + local background_jobs_number=${$(jobs -l | wc -l)// /} if [[ background_jobs_number -gt 0 ]]; then local background_jobs_number_print="" if [[ POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE ]] && [[ background_jobs_number -gt 1 ]]; then From ce72ca3a16d1d06c233082fa5ce8baa9094704e1 Mon Sep 17 00:00:00 2001 From: v1rgul Date: Fri, 22 Jan 2016 02:11:25 +0100 Subject: [PATCH 3/3] add background_jobs change in changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a0f4cfc..816a0dc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND='black' POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND='white' ``` +### `background_jobs` changes +Now displays the number of background jobs if there's more than 1. +You can disable it by setting : +```zsh +POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=false +``` + ## v0.3.0 ### Introduced "visual identifiers" to the segments