aboutsummaryrefslogtreecommitdiffstats
path: root/polybar/usr/bin/count-emails
diff options
context:
space:
mode:
Diffstat (limited to 'polybar/usr/bin/count-emails')
-rwxr-xr-xpolybar/usr/bin/count-emails15
1 files changed, 15 insertions, 0 deletions
diff --git a/polybar/usr/bin/count-emails b/polybar/usr/bin/count-emails
new file mode 100755
index 0000000..98a2573
--- /dev/null
+++ b/polybar/usr/bin/count-emails
@@ -0,0 +1,15 @@
+#!/usr/bin/env -S scsh -s
+;; -*- mode: scheme; -*-
+!#
+
+(define mail-root (string-append (getenv "HOME") "/documents/mail"))
+
+(define unread-emails
+ (run/sexp (pipe (find ,mail-root -type f -name "*:2,*" -and -not -name "*:2,*S*")
+ (wc -l))))
+
+(define new-emails
+ (run/sexp (pipe (find ,mail-root -type f -wholename "*/new/*")
+ (wc -l))))
+
+(display (+ unread-emails new-emails))