aboutsummaryrefslogtreecommitdiffstats
path: root/polybar/usr
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-11-06 01:15:25 -0700
committerGravatar Tom Willemse2021-11-06 01:15:25 -0700
commit7c7c01ea76d4d2a93397514f36f57ddded5f9247 (patch)
tree2cb41b2ff2ad0b26dd667334b0ce8efaa78584ab /polybar/usr
parent9872c1c4c2f56f14cdeedad4dece3c0ddac73b42 (diff)
downloadnew-dotfiles-7c7c01ea76d4d2a93397514f36f57ddded5f9247.tar.gz
new-dotfiles-7c7c01ea76d4d2a93397514f36f57ddded5f9247.zip
[polybar] Show the total number of unread emails
Diffstat (limited to 'polybar/usr')
-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))