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' passwordCMD: 'pass show proton/bridge'
xoAuth2: false xoAuth2: false
# onNewMail: '/home/fic/.config/mail/mail-sync.sh' # onNewMail: '/home/fic/.config/mail/mail-sync.sh'
# onDeletedMail: '/home/fic/.config/mail/mail-sync.sh'
wait: 20 wait: 20
boxes: boxes:
- -
mailbox: INBOX mailbox: INBOX
# onNewMail: '/home/fic/.config/mail/newmail.sh personal' onNewMail: '/home/fic/.config/mail/newmail.sh personal'
- -
mailbox: Sent mailbox: Sent
# onNewMail: '/home/fic/.config/mail/mail-sync.sh'
- -
host: outlook.office365.com host: outlook.office365.com
port: 993 port: 993
@ -30,12 +28,9 @@ configurations:
username: 18daf3@queensu.ca username: 18daf3@queensu.ca
passwordCMD: '~/tools/mutt_oauth2.py ~/tools/tokenfile-test' passwordCMD: '~/tools/mutt_oauth2.py ~/tools/tokenfile-test'
xoAuth2: true xoAuth2: true
# onNewMail: '/home/fic/.config/mail/mail-sync.sh'
# onDeletedMail: '/home/fic/.config/mail/mail-sync.sh'
wait: 20 wait: 20
boxes: boxes:
- mailbox: INBOX - mailbox: INBOX
# onNewMail: '/home/fic/.config/mail/newmail.sh school' onNewMail: '/home/fic/.config/mail/newmail.sh school'
- -
mailbox: Sent Items 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 # Create pipe if doesn't exist
[[ -p "$PIPE" ]] || mkfifo "$PIPE" [[ -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 and format for waybar
get_unread_counts() { get_unread_counts() {
@ -24,21 +27,26 @@ get_unread_counts() {
# run once for initial output # run once for initial output
echo "mail init" echo "mail init |"
# begin event loop # begin event loop
while true; do while true; do
# cat blocks until data comes through pipe # cat blocks until data comes through pipe
# redirecting to null b.c. we don't want the # redirecting to null b.c. we don't want the
# pipe's contents to be printed to stdout # pipe's contents to be printed to stdout
PAYLOAD=$(cat /tmp/email_refresh_pipe) PAYLOAD=$(cat /tmp/email_refresh_pipe)
if [ "$PAYLOAD" == "new" ]; then if [ "$PAYLOAD" == "add" ]; then
count=$(cat "$COUNT") count=$(cat "$COUNT")
((count++)) > "$COUNT" ((count++))
elif [ "$PAYLOAD" == "reset" ]; then echo "$count" > "$COUNT"
"0" > "$COUNT" echo "new: $(cat "$COUNT") |"
# elif [ "$PAYLOAD" == "reset" ]; then
# "0" > "$COUNT"
elif [ "$PAYLOAD" == "show_precise" ]; then elif [ "$PAYLOAD" == "show_precise" ]; then
echo "0" > "$COUNT"
get_unread_counts get_unread_counts
elif [ "$PAYLOAD" == "show_since" ]; then elif [ "$PAYLOAD" == "show_since" ]; then
echo "new: $(cat "$COUNT")" echo "new: $(cat "$COUNT") |"
else
get_unread_counts
fi fi
done done

View file

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

View file

@ -1,4 +1,9 @@
#!/bin/env bash #!/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!" 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
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
SyncDocuments /home/fic/SyncDocuments s
Pictures /home/fic/Pictures/ p Pictures /home/fic/Pictures/ p
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
Downloads /home/fic/Downloads D
Documents /home/fic/Documents d Documents /home/fic/Documents d
Documents /home/fic/Documents/ d Documents /home/fic/Documents/ d