From 015e6242aac104c6682e09e48123e775063d26e3 Mon Sep 17 00:00:00 2001 From: Andrew Baumann Date: Fri, 28 Jul 2017 11:06:04 -0700 Subject: [PATCH] agnoster: improve perf with use of $jobstates (zsh/parameter module) This saves multiple fork/execs (for the subshell and wc) each time the prompt is rendered --- themes/agnoster.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 07546fd34..5a44864db 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -29,6 +29,7 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' +zmodload zsh/parameter # Special Powerline characters @@ -207,7 +208,7 @@ prompt_status() { symbols=() [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" + [[ ${#jobstates} -ne 0 ]] && symbols+="%{%F{cyan}%}⚙" [[ -n "$symbols" ]] && prompt_segment black default "$symbols" }