From d9ed39fc2efe9e270e5e767d549a5f52ce9df745 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 19 Sep 2020 11:23:21 +0100 Subject: [PATCH] Adds unread emails to prompt --- shells/zsh/includes/promptconfig.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/shells/zsh/includes/promptconfig.zsh b/shells/zsh/includes/promptconfig.zsh index a17f4491..a85154f5 100644 --- a/shells/zsh/includes/promptconfig.zsh +++ b/shells/zsh/includes/promptconfig.zsh @@ -160,6 +160,15 @@ prompt_last_exit_code() { fi } +prompt_email(){ + unread="$(notmuch count "tag:unread")" + if [ "$unread" -gt 0 ]; then + echo "🖂 $unread" + echo "yellow3" + fi +} + + # Draws a seperator # Takes 2 arguments, from color then to color # If only 1 given, assumes it is the last @@ -226,6 +235,13 @@ set_prompts(){ background="$(echo "$segment" | sed -n '2p')" fi + # Emails + segment="$(draw_segment "prompt_email" "$background")" + if [ -n "$(echo "$segment" | sed -n '1p')" ];then + PROMPT="$PROMPT$(echo "$segment" | sed -n '1p')" + background="$(echo "$segment" | sed -n '2p')" + fi + # Git segment="$(draw_segment "prompt_git" "$background")" if [ -n "$(echo "$segment" | sed -n '1p')" ];then