summaryrefslogtreecommitdiff
path: root/.config/eww/scripts
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-09-14 23:34:03 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-09-14 23:34:03 +0200
commit45d1380289c577f1a04c8117ff36ff374d82023c (patch)
tree73e204cc05515a9a0974a3ab607a59b5edc1bd95 /.config/eww/scripts
parentc18c3c1df4c7b3ca721f7ee6278ffddff93dc95a (diff)
eww: Add a widget for email
Diffstat (limited to '.config/eww/scripts')
-rwxr-xr-x.config/eww/scripts/email-listener28
1 files changed, 28 insertions, 0 deletions
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
+#''