From 532332b8df5dba470bfe96f95592153e303cefa3 Mon Sep 17 00:00:00 2001 From: appeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com> Date: Wed, 15 Nov 2023 18:39:23 +0000 Subject: Fix notify-send not coming through --- bin/mailsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index cbd36ff..1d403d6 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -63,11 +63,11 @@ syncandnotify() { newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) - echo "$newcount new mail for $2." + echo "$newcount new mail for $2." >/dev/tty [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account." ;; $((newcount > 0)) ) - echo "$newcount new mail for $2." + echo "$newcount new mail for $2." >/dev/tty [ -z "$MAILSYNC_MUTE" ] && for file in $new; do # Extract and decode subject and sender from mail. -- cgit v1.2.3 From 43eceb55364dc0e6b1bf35ff461f7c2554ff8e8e Mon Sep 17 00:00:00 2001 From: Jonas Dujava Date: Mon, 2 Sep 2024 12:24:34 +0200 Subject: Fix notifications for mails with multiline subject Signed-off-by: Jonas Dujava --- bin/mailsync | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index cbd36ff..2cf6619 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -70,9 +70,10 @@ syncandnotify() { echo "$newcount new mail for $2." [ -z "$MAILSYNC_MUTE" ] && for file in $new; do - # Extract and decode subject and sender from mail. - subject="$(sed -n "/^Subject:/ s|Subject: *|| p" "$file" | - perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" + # Extract and decode subject and sender from mail. + subject=$(awk '/^Subject: / && ++n == 1,/^.*: / && ++i == 2' "$file" | head -n-1 | + perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | + sed 's/^Subject: //' | tr -d '\n\t') from="$(sed -n "/^From:/ s|From: *|| p" "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" -- cgit v1.2.3 From 8e35e474c585adb428a88ff6da5e89754c49a448 Mon Sep 17 00:00:00 2001 From: Jonas Dujava Date: Mon, 2 Sep 2024 13:01:41 +0200 Subject: Fix usages of mail/mails Signed-off-by: Jonas Dujava --- bin/mailsync | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index cbd36ff..792e7af 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -63,11 +63,11 @@ syncandnotify() { newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) case 1 in $((newcount > 5)) ) - echo "$newcount new mail for $2." - [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mail(s) in \`$2\` account." + echo "$newcount new mails for $2." + [ -z "$MAILSYNC_MUTE" ] && notify "New Mail!" "📬 $newcount new mails in \`$2\` account." ;; $((newcount > 0)) ) - echo "$newcount new mail for $2." + echo "$newcount new mail(s) for $2." [ -z "$MAILSYNC_MUTE" ] && for file in $new; do # Extract and decode subject and sender from mail. -- cgit v1.2.3 From 824feedc6889ae9630891c9b75e83b5387896838 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Wed, 18 Sep 2024 22:29:55 +0300 Subject: fix(mailsync): delimit notification text from flags Fixes text being interpreted as flags when it starts with a dash. Try sending yourself a letter with subject starting with '-'. E.g. if subject is '-10%' fixes error: > Unknown option -10% --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/mailsync') diff --git a/bin/mailsync b/bin/mailsync index cbd36ff..866859e 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -45,7 +45,7 @@ case "$(uname)" in notify() { [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do export DISPLAY="$x" - notify-send --app-name="mutt-wizard" "$1" "$2" + notify-send --app-name="mutt-wizard" -- "$1" "$2" done ;} ;; esac -- cgit v1.2.3