From 54982410a90d808980f685f2002f8c7ea4da0ff5 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Fri, 27 Nov 2026 14:31:48 -0800 Subject: [PATCH] perf(agnoster): count background jobs with `$jobstates` The job indicator ran `jobs -l | wc -l` in a command substitution on every prompt. `${#jobstates}` gives the same count without forking a pipeline, and still sees the parent's jobs inside the prompt's command substitution. Refs #14252 Co-Authored-By: Claude Opus 5.5 --- themes/agnoster.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 6b6c202a9..fa1fea1f7 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -338,7 +338,7 @@ prompt_status() { [[ $RETVAL -ne 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_RETVAL_FG}%}✘" fi [[ $UID -eq 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_ROOT_FG}%}⚡" - [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙" + (( ${#jobstates} )) && symbols+="%{%F{$AGNOSTER_STATUS_JOB_FG}%}⚙" [[ -n "$symbols" ]] && prompt_segment "$AGNOSTER_STATUS_BG" "$AGNOSTER_STATUS_FG" "$symbols" }