diff options
Diffstat (limited to 'X11/mail')
-rwxr-xr-x | X11/mail/check_mail.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/X11/mail/check_mail.sh b/X11/mail/check_mail.sh new file mode 100755 index 0000000..b6cca10 --- /dev/null +++ b/X11/mail/check_mail.sh | |||
@@ -0,0 +1,18 @@ | |||
1 | #! /bin/bash | ||
2 | |||
3 | IMAP_SERVER=$1 | ||
4 | LOG_INFO=$2 | ||
5 | |||
6 | NUMBER=$( | ||
7 | curl -s -u $LOG_INFO $IMAP_SERVER -X 'STATUS INBOX (UNSEEN)' | \ | ||
8 | sed -E 's/^.+\(UNSEEN ([0-9]+)\).+$/\1/' | \ | ||
9 | tr -d '\r' | ||
10 | ) | ||
11 | |||
12 | if [[ -n "$NUMBER" && $NUMBER -gt 0 ]]; then | ||
13 | DISPLAY=:0 \ | ||
14 | DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/`id -u`/bus \ | ||
15 | notify-send "New Mail: $NUMBER" | ||
16 | else | ||
17 | date | ||
18 | fi | ||