aboutsummaryrefslogtreecommitdiffhomepage
path: root/X11/mail
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2022-11-10 16:05:04 +0800
committerHsieh Chin Fan <pham@topo.tw>2022-11-10 16:05:04 +0800
commit66009d86cf2939d2a84d8643a00f4b82c3426437 (patch)
treec6d5bf073f17cf4598c1ce8bc1503410de5e2105 /X11/mail
parente0b65600da267e651e33edf84731b3b06a51808f (diff)
Add script about mail
Diffstat (limited to 'X11/mail')
-rwxr-xr-xX11/mail/check_mail.sh18
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
3IMAP_SERVER=$1
4LOG_INFO=$2
5
6NUMBER=$(
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
12if [[ -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"
16else
17 date
18fi