From 2f45a347ac75db308d96db93c2b4aaeed09502d7 Mon Sep 17 00:00:00 2001 From: crater2150 Date: Thu, 2 Mar 2023 16:07:52 +0100 Subject: [PATCH] Add mails from cron to prompt --- aliases/functions | 2 ++ completion.zsh | 1 + zshrc | 12 ++++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/aliases/functions b/aliases/functions index 1f32177..0b62299 100644 --- a/aliases/functions +++ b/aliases/functions @@ -13,6 +13,8 @@ alias :q="exit" alias rget="rsync -rP --append-verify --inplace" alias 7zu="7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on" +alias cronmail="mutt -f $MAIL" + if ! command -v fd >/dev/null; then fd() { if [[ "$1" =~ "-*" ]]; then diff --git a/completion.zsh b/completion.zsh index 14b3509..0f4a3b2 100644 --- a/completion.zsh +++ b/completion.zsh @@ -1,5 +1,6 @@ # autoload completions fpath=( "${ZDOTDIR:+$ZDOTDIR/compdef}" "/etc/zsh/compdef" $fpath ) +fpath=("$XDG_DATA_HOME/scalacli/completions/zsh" $fpath) [[ -n $(echo /etc/zsh/compdef/*(N:t)) ]] && autoload -U /etc/zsh/compdef/*(N:t) [[ -n $(echo $ZDOTDIR/compdef/*(N:t)) ]] && autoload -U $ZDOTDIR/compdef/*(N:t) diff --git a/zshrc b/zshrc index 9dccfcb..5c6d2f2 100644 --- a/zshrc +++ b/zshrc @@ -102,7 +102,11 @@ if [[ -e $HOME/.calendars ]]; then } __chromaz_extra_left+=_prompt_todos fi -# >>> scala-cli completions >>> -fpath=("/home/crater2150/.local/share/scalacli/completions/zsh" $fpath) -compinit -# <<< scala-cli completions <<< + +if exists mail; then + _prompt_cron_mails() { + local newmails=$(mail -Hf $MAIL | grep -c '^.N') + [[ $newmails -gt 0 ]] && echo "Cron Notifications: $newmails" + } + __chromaz_extra_left+=_prompt_cron_mails +fi