Update prompt with task counter

This commit is contained in:
Talia 2023-09-26 09:30:38 +02:00
parent 9561777fb7
commit de09d79b1f

21
zshrc
View file

@ -30,6 +30,23 @@ task_prompt() {
fi fi
fi fi
} }
due_soon_prompt() {
if [ $run_task_prompt -eq 0 ]
then
if [ "$(task +PENDING due.before:30min count)" -gt 0 ]; then
echo "%F{red}%B$(task +PENDING +DUE count)%b "; return
fi
if [ "$(task +PENDING due.before:1h count)" -gt 0 ]; then
echo "%F{yellow}%B$(task +PENDING +DUE count)%b "; return
fi
if [ "$(task +PENDING due.before:3h count)" -gt 0 ]; then
echo "%F{green}%B$(task +PENDING +DUE count)%b "; return
fi
if [ "$(task +PENDING due.before:tomorrow count)" -gt 0 ]; then
echo "%F{black}%B$(task +PENDING +DUE count)%b "; return
fi
fi
}
which timew > /dev/null which timew > /dev/null
run_timew_prompt=$? run_timew_prompt=$?
@ -52,9 +69,9 @@ ranger_prompt() {
} }
prompt='$(task_prompt)%(?.%F{green}.%F{red})λ%F{blue}$(ranger_prompt)%f ' prompt='$(task_prompt)%(?.%F{green}.%F{red})λ%F{blue}$(ranger_prompt)%f '
export PROMPT_full='$(timew_prompt)%B%F{magenta}%n%F{blue}@%F{magenta}%m%b %F{magenta}%~ export PROMPT_full='$(due_soon_prompt)%B%F{magenta}%n%F{blue}@%F{magenta}%m%b %F{magenta}%~
'"$prompt" '"$prompt"
export PROMPT_gitlong='%F{red}$(timew_prompt)$(gitprompt && echo -ne " ")%F$(git log --oneline --no-decorate -1 2>/dev/null) export PROMPT_gitlong='$(due_soon_prompt)$(gitprompt && echo -ne " ")%F$(git log --oneline --no-decorate -1 2>/dev/null)
%F{cyan}$(gitpath)'"$prompt" %F{cyan}$(gitpath)'"$prompt"
# export PS1tiny= # export PS1tiny=
# export PS1nano= # export PS1nano=