diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2016-01-22 05:59:37 +0300 |
---|---|---|
committer | Ben Hilburn <bhilburn@gmail.com> | 2016-01-22 05:59:37 +0300 |
commit | 8172425cd2626f19b67f1309230e712d5a55ecf7 (patch) | |
tree | 5922bbe14261fe66915545e848dc2fe9db850639 | |
parent | 67895cc5da1fe479d0ae321fba750e199758eee4 (diff) | |
parent | ce72ca3a16d1d06c233082fa5ce8baa9094704e1 (diff) |
Merge pull request #200 from V1rgul/next
background_jobs segment : add number of jobs if >1
-rw-r--r-- | CHANGELOG.md | 7 | ||||
-rwxr-xr-x | powerlevel9k.zsh-theme | 10 |
2 files changed, 15 insertions, 2 deletions
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 diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index c8879dbc..f464e10e 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 } |