From 36788d9c439729f97edda2aba75bf477f029dca2 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sun, 30 May 2021 21:21:31 -0400 Subject: don't readlink for soystemd on mac --- bin/mailsync | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index af7aa6c..f739584 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -25,9 +25,6 @@ eval "$(grep -h -- \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" -case "$(readlink -f /sbin/init)" in - *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; -esac export GPG_TTY=$TTY [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" @@ -39,6 +36,9 @@ case "$(uname)" in messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) + case "$(readlink -f /sbin/init)" in + *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;; + esac # remember if a display server is running since `ps` doesn't always contain a display pgrepoutput="$(pgrep -a X\(org\|wayland\))" displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)" -- cgit v1.2.3 From b9a95a055a5737c7765c2d21451d504c9818ba80 Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 15 Jun 2021 20:14:18 +0200 Subject: patch mailsync on macOS; fixes #725 The macOS version of `pidof` doesn't implement the `-s` flag. --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index f739584..a026354 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pidof -s mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} +pidof $([ $(uname) != Darwin ] && echo '-s') mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile -- cgit v1.2.3 From b0452a39d5b573a9a12da0064c0341846ba8ff5d Mon Sep 17 00:00:00 2001 From: Kr1ss Date: Tue, 15 Jun 2021 22:08:30 +0200 Subject: remove `pidof -s` flag Ref: https://github.com/LukeSmithxyz/mutt-wizard/commit/b9a95a055a5737c7765c2d21451d504c9818ba80#commitcomment-52203708 --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index a026354..f00baf1 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -14,7 +14,7 @@ # Run only if user logged in (prevent cron errors) pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} # Run only if not already running in other instance -pidof $([ $(uname) != Darwin ] && echo '-s') mbsync >/dev/null && { echo "mbsync is already running."; exit ;} +pidof mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # First, we have to get the right variables for the mbsync file, the pass # archive, notmuch and the GPG home. This is done by searching common profile -- cgit v1.2.3 From 5971fadec832e6b970e7911e1919432c6052fdc7 Mon Sep 17 00:00:00 2001 From: Horea Christian Date: Thu, 9 Sep 2021 19:04:18 -0400 Subject: Check both new and cur dirs for notification Also better formattin --- bin/mailsync | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index f00baf1..a633308 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -57,7 +57,14 @@ esac syncandnotify() { acc="$(echo "$account" | sed "s/.*\///")" if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi - new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) + new=$(find\ + "$HOME/.local/share/mail/$acc/INBOX/new/"\ + "$HOME/.local/share/mail/$acc/Inbox/new/"\ + "$HOME/.local/share/mail/$acc/inbox/new/"\ + "$HOME/.local/share/mail/$acc/INBOX/cur/"\ + "$HOME/.local/share/mail/$acc/Inbox/cur/"\ + "$HOME/.local/share/mail/$acc/inbox/cur/"\ + -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) notify "$acc" "$newcount" ;; -- cgit v1.2.3 From f845e11fe281dd144311ff619cf16388a0f636e3 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 16 Sep 2021 15:07:47 -0400 Subject: fix #745, avoid incompatibility --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index a633308..4469d55 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -25,7 +25,7 @@ eval "$(grep -h -- \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" "$HOME/.pam_environment" 2>/dev/null)" -export GPG_TTY=$TTY +export GPG_TTY="$(tty)" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" -- cgit v1.2.3 From 8d177222d6d07ada68930a64a0f7a2e320817094 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 23 Sep 2021 12:59:15 -0400 Subject: don't show message info anymore --- bin/mailsync | 13 +------------ share/domains.csv | 1 + 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index 4469d55..bed86a9 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -33,7 +33,6 @@ export GPG_TTY="$(tty)" case "$(uname)" in Darwin) notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} - messageinfo() { osascript -e "display notification with title \"📧 $from\" subtitle \"$subject\"" ;} ;; *) case "$(readlink -f /sbin/init)" in @@ -46,10 +45,6 @@ case "$(uname)" in export DISPLAY=$x notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." done ;} - messageinfo() { [ -n "$pgrepoutput" ] && for x in ${displays:-0:}; do - export DISPLAY=$x - notify-send --app-name="mutt-wizard" "📧$from:" "$subject" - done ;} ;; esac @@ -67,13 +62,7 @@ syncandnotify() { -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2> /dev/null) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in - $((newcount > 5)) ) notify "$acc" "$newcount" ;; - $((newcount > 0)) ) for file in $new; do - # Extract subject and sender from mail. - from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') - subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') - messageinfo & - done ;; + $((newcount > 0)) ) notify "$acc" "$newcount" ;; esac } diff --git a/share/domains.csv b/share/domains.csv index 2ec18f1..a3eb574 100644 --- a/share/domains.csv +++ b/share/domains.csv @@ -49,6 +49,7 @@ canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 carleton.ca,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 cash4u.com,imap.mail.com,993,smtp.mail.com,587 +cedars.xyz,imap.cedars.xyz,993,smtp.cedars.xyz,465 ceng.metu.edu.tr,imap.ceng.metu.edu.tr,993,mailhost.ceng.metu.edu.tr,587 cheerful.com,imap.mail.com,993,smtp.mail.com,587 chef.net,imap.mail.com,993,smtp.mail.com,587 -- cgit v1.2.3