[polybar] Use notmuch if available to count unread emails
This commit is contained in:
parent
74706d063c
commit
6c3bf82014
1 changed files with 12 additions and 12 deletions
|
@ -1,17 +1,17 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# -*- mode: scheme; -*-
|
# -*- mode: scheme; -*-
|
||||||
IFS=" "
|
IFS=" "
|
||||||
exec scsh -s "$0" "$@"
|
exec scsh -o thread-fluids -s "$0" "$@"
|
||||||
!#
|
!#
|
||||||
|
|
||||||
(define mail-root (string-append (getenv "HOME") "/documents/mail"))
|
(if (exec-path-search "notmuch" (thread-fluid exec-path-list))
|
||||||
|
(display (length (run/sexp (notmuch search --output=files --format=sexp tag:unread))))
|
||||||
(define unread-emails
|
(begin
|
||||||
|
(let* ((mail-root (string-append (getenv "HOME") "/documents/mail"))
|
||||||
|
(unread-emails
|
||||||
(run/sexp (pipe (find ,mail-root -type f -name "*:2,*" -and -not -name "*:2,*S*")
|
(run/sexp (pipe (find ,mail-root -type f -name "*:2,*" -and -not -name "*:2,*S*")
|
||||||
(wc -l))))
|
(wc -l))))
|
||||||
|
(new-emails
|
||||||
(define new-emails
|
|
||||||
(run/sexp (pipe (find ,mail-root -type f -wholename "*/new/*")
|
(run/sexp (pipe (find ,mail-root -type f -wholename "*/new/*")
|
||||||
(wc -l))))
|
(wc -l)))))
|
||||||
|
(display (+ unread-emails new-emails)))))
|
||||||
(display (+ unread-emails new-emails))
|
|
||||||
|
|
Loading…
Reference in a new issue