summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/eww/eww.yuck7
-rwxr-xr-x.config/eww/scripts/email-listener28
2 files changed, 35 insertions, 0 deletions
diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck
index 667c717..49a0a11 100644
--- a/.config/eww/eww.yuck
+++ b/.config/eww/eww.yuck
@@ -17,6 +17,9 @@
(deflisten keymap
`stdbuf -oL scripts/keymap-listener`)
+(deflisten emails
+ `stdbuf -oL scripts/email-listener`)
+
;; Pollers
(defpoll battery :initial '{"icon":"","percentage":""}' :interval "1s"
`scripts/battery`)
@@ -65,6 +68,7 @@
(box :halign "end"
:class "end"
:space-evenly false
+ (emails)
(keymap)
(wireless)
(brightness)
@@ -98,6 +102,9 @@
(defwidget battery []
(pair :icon {battery.icon} :text {battery.percentage}))
+(defwidget emails []
+ (pair :icon "" :text emails))
+
(defwidget pair [icon text]
(box :width 70
:space-evenly false
diff --git a/.config/eww/scripts/email-listener b/.config/eww/scripts/email-listener
new file mode 100755
index 0000000..c205025
--- /dev/null
+++ b/.config/eww/scripts/email-listener
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+count()
+{
+ x=`find "$MAILDIR"/*/Inbox/new -type f | wc -l`
+ case $x in
+ 0)
+ echo 'No New Mail'
+ ;;
+ 1)
+ echo '1 New Mail'
+ ;;
+ *)
+ printf '%d New Mails\n' $x
+ ;;
+ esac
+}
+
+count
+inotifywait -qm "$MAILDIR"/*/Inbox/new | while read _ event _
+do
+ case "$event" in
+ CREATE|DELETE|MOVED_*)
+ count
+ ;;
+ esac
+done
+#''