From: Samir Benmendil Date: Mon, 27 Jan 2025 20:46:16 +0000 (+0000) Subject: zsh: add a count of todays taskwarrior tasks to prompt X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/8323e8ce778e413d2cca20ea442717c78e1e0939?hp=945d00ec64ecf43e7732aec3b889cc5dd5bfc7b2 zsh: add a count of todays taskwarrior tasks to prompt --- diff --git a/zsh/lib/prompt.zsh b/zsh/lib/prompt.zsh index f6a8daf..3ca62a4 100644 --- a/zsh/lib/prompt.zsh +++ b/zsh/lib/prompt.zsh @@ -6,7 +6,7 @@ hostcolor=cyan [[ $(hostname) == "tardis" ]] && hostcolor=red precmd() { - PROMPT=$'%T %n@%{$fg[$hostcolor]%}%m$(jobs_prompt)%-0>..>$(git_prompt_status)%>>\n' + PROMPT=$'%T $(task_today_list)%n@%{$fg[$hostcolor]%}%m$(jobs_prompt)%-0>..>$(git_prompt_status)%>>\n' PROMPT+=$'$(virtualenv_prompt)%(?..%{$fg_bold[white]%}%?)%{$reset_color%}$(vi_prompt_info)%{%(!.$fg[red]❰.$fg[green]❱)%1G%} ' RPROMPT='%{$fg[green]%}%~%{$reset_color%}' } @@ -135,3 +135,13 @@ function print_if_fits() { length=${#${(S%%)1//$~zero/}} echo "%-$length(l.$1.)" } + +function task_today_list() { + local task_cmd=(task rc.verbose:nothing) + local task_count=$($task_cmd $($task_cmd _get rc.report.today.filter) count) + + local task_status="" + task_status+="%{$fg_bold[red]%} $task_count " + task_status+="%{$reset_color%}" + echo $task_status +}