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

This commit is contained in:
Daniel Fichtinger 2025-03-17 22:30:08 -04:00
parent a910267105
commit 0e26e9f3fa
7 changed files with 27 additions and 17 deletions

View file

@ -1 +1 @@
config##hostname.dpad config##hostname.dbox

View file

@ -9,17 +9,17 @@ configurations:
username: daniel@ficd.ca username: daniel@ficd.ca
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' # 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' # onNewMail: '/home/fic/.config/mail/mail-sync.sh'
- -
host: outlook.office365.com host: outlook.office365.com
port: 993 port: 993
@ -30,12 +30,12 @@ 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' # onNewMail: '/home/fic/.config/mail/mail-sync.sh'
onDeletedMail: '/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' # onNewMail: '/home/fic/.config/mail/mail-sync.sh'

View file

@ -1 +1 @@
kitty.conf##hostname.dpad kitty.conf##hostname.dbox

View file

@ -5,9 +5,11 @@ MAILBOXES=("personal" "school")
# named pipe for receiving refresh events # named pipe for receiving refresh events
# from mail sync script # from mail sync script
PIPE="/tmp/email_refresh_pipe" PIPE="/tmp/email_refresh_pipe"
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"
# Get unread counts and format for waybar # Get unread counts and format for waybar
get_unread_counts() { get_unread_counts() {
@ -22,13 +24,21 @@ get_unread_counts() {
# run once for initial output # run once for initial output
get_unread_counts 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
cat /tmp/email_refresh_pipe > /dev/null PAYLOAD=$(cat /tmp/email_refresh_pipe)
# print unread indicator to stdout if [ "$PAYLOAD" == "new" ]; then
count=$(cat "$COUNT")
((count++)) > "$COUNT"
elif [ "$PAYLOAD" == "reset" ]; then
"0" > "$COUNT"
elif [ "$PAYLOAD" == "show_precise" ]; then
get_unread_counts get_unread_counts
elif [ "$PAYLOAD" == "show_since" ]; then
echo "new: $(cat "$COUNT")"
fi
done done

View file

@ -1,4 +1,4 @@
#!/bin/env bash #!/bin/env bash
notify-send "New mail in $1 inbox!" notify-send "New mail in $1 inbox!"
/home/fic/.config/mail/mail-sync.sh # /home/fic/.config/mail/mail-sync.sh

View file

@ -1 +1 @@
config.kdl##hostname.dpad config.kdl##hostname.dbox

View file

@ -1 +1 @@
config##hostname.dpad config##hostname.dbox