Preface :
A year ago, I wrote down a little story
about how I read my emails on my smartphone (postmarketOS/Sxmo) with Mutt.
Two days ago, Sxmo got updated to version 1.17.0.
In this new version, sxmo_notificationwrite.sh
is replaced with sxmo_notifs.sh
.
So, I’ve updated the notifications part.
Notifications
To get notifications when new mail arrives, I’ve added the following to ~/.config/sxmo/hooks/sxmo_hook_start.sh
# mail notification
MAILDIR=~/Maildir
inotifywait -m $MAILDIR/new -e moved_to |
while read path action file; do
FROM=$(grep '^From:' $path$file | cut -d' ' -f2- | cut -d'<' -f1)
SUBJECT=$(grep '^Subject' $path$file | cut -d' ' -f2-)
# create notification with ID=$file
sxmo_notifs.sh new -i $file "sxmo_terminal.sh mutt" "E-mail $FROM - $SUBJECT"
#sxmo_notificationwrite.sh random "sxmo_terminal.sh mutt" $path$file "E-mail $FROM - $SUBJECT"
#watchfile - remove notification after reading email
inotifywait $path$file && rm $SXMO_NOTIFDIR/$file &
sxmo_vibrate 200 65535
done &