AutoYADM commit: 2025-03-17 22:45:07

This commit is contained in:
Daniel Fichtinger 2025-03-17 22:45:07 -04:00
parent 0e26e9f3fa
commit ece7017d1e
5 changed files with 26 additions and 18 deletions

View file

@ -10,16 +10,14 @@ configurations:
passwordCMD: 'pass show proton/bridge'
xoAuth2: false
# onNewMail: '/home/fic/.config/mail/mail-sync.sh'
# onDeletedMail: '/home/fic/.config/mail/mail-sync.sh'
wait: 20
boxes:
-
mailbox: INBOX
# onNewMail: '/home/fic/.config/mail/newmail.sh personal'
onNewMail: '/home/fic/.config/mail/newmail.sh personal'
-
mailbox: Sent
# onNewMail: '/home/fic/.config/mail/mail-sync.sh'
-
host: outlook.office365.com
port: 993
@ -30,12 +28,9 @@ configurations:
username: 18daf3@queensu.ca
passwordCMD: '~/tools/mutt_oauth2.py ~/tools/tokenfile-test'
xoAuth2: true
# onNewMail: '/home/fic/.config/mail/mail-sync.sh'
# onDeletedMail: '/home/fic/.config/mail/mail-sync.sh'
wait: 20
boxes:
- mailbox: INBOX
# onNewMail: '/home/fic/.config/mail/newmail.sh school'
onNewMail: '/home/fic/.config/mail/newmail.sh school'
-
mailbox: Sent Items
# onNewMail: '/home/fic/.config/mail/mail-sync.sh'

View file

@ -9,7 +9,10 @@ COUNT="/tmp/email_count"
# Create pipe if doesn't exist
[[ -p "$PIPE" ]] || mkfifo "$PIPE"
[[ -e "$COUNT" ]] || echo "0" > "$COUNT"
if [ ! -e "$COUNT" ]; then
echo "0" > "$COUNT"
fi
# Get unread counts and format for waybar
get_unread_counts() {
@ -24,21 +27,26 @@ get_unread_counts() {
# run once for initial output
echo "mail init"
echo "mail init |"
# begin event loop
while true; do
# cat blocks until data comes through pipe
# redirecting to null b.c. we don't want the
# pipe's contents to be printed to stdout
PAYLOAD=$(cat /tmp/email_refresh_pipe)
if [ "$PAYLOAD" == "new" ]; then
if [ "$PAYLOAD" == "add" ]; then
count=$(cat "$COUNT")
((count++)) > "$COUNT"
elif [ "$PAYLOAD" == "reset" ]; then
"0" > "$COUNT"
((count++))
echo "$count" > "$COUNT"
echo "new: $(cat "$COUNT") |"
# elif [ "$PAYLOAD" == "reset" ]; then
# "0" > "$COUNT"
elif [ "$PAYLOAD" == "show_precise" ]; then
echo "0" > "$COUNT"
get_unread_counts
elif [ "$PAYLOAD" == "show_since" ]; then
echo "new: $(cat "$COUNT")"
echo "new: $(cat "$COUNT") |"
else
get_unread_counts
fi
done

View file

@ -23,6 +23,6 @@ notmuch new
# new mail tagging pipeline
afew --tag --new
# signal waybar indicator update
echo "refresh" > "$PIPE"
echo "show_precise" > "$PIPE"
# generate new ranked addressbook
maildir-rank-addr

View file

@ -1,4 +1,9 @@
#!/bin/env bash
PIPE="/tmp/email_refresh_pipe"
# Create pipe if doesn't exist
[ -p "$PIPE" ] || mkfifo "$PIPE"
notify-send "New mail in $1 inbox!"
# /home/fic/.config/mail/mail-sync.sh
echo "add" > "$PIPE"

View file

@ -1,10 +1,10 @@
Videos /home/fic/Videos v
Videos /home/fic/Videos/ v
SyncDocuments /home/fic/SyncDocuments s
SyncDocuments /home/fic/SyncDocuments/ s
SyncDocuments /home/fic/SyncDocuments s
Pictures /home/fic/Pictures/ p
Pictures /home/fic/Pictures p
Downloads /home/fic/Downloads D
Downloads /home/fic/Downloads/ D
Downloads /home/fic/Downloads D
Documents /home/fic/Documents d
Documents /home/fic/Documents/ d