commit c35bfb0b2590bbf2a92cc297181016017171f7de parent 4b7b01c5125b07df20abc893f41fd0adb8f17d5a Author: Ed van Bruggen <edvb54@gmail.com> Date: Sun, 19 Feb 2017 16:52:12 -0800 bin: Add dwmmail.sh Notifies you via dwm's status bar when you get new mail and displays how many unread messages you have. Diffstat:
bin/dwmmail.sh | | | 13 | +++++++++++++ |
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/bin/dwmmail.sh b/bin/dwmmail.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +fetchmail --check 2>/dev/null | while read line; do + new=$(echo "$line" | sed 's/(//' | awk '{print $1-$3}') + if [ "$new" != 0 ] && [ ! -e ~/.msg ]; then + echo "New mail($new)" > ~/.msg + echo "!!! !!! !!!" >> ~/.msg + sleep 5 + if grep '^New mail' ~/.msg >/dev/null 2>/dev/null; then + rm -f ~/.msg + fi + fi +done