From c224d29547f7f4d38b6216f79f8305f533c506bf Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 22 Jul 2025 23:42:46 +0200 Subject: [PATCH 1/2] feat(mailsync): open email notify-send action --- bin/mailsync | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index 3a681f0..bdda018 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -80,7 +80,20 @@ syncandnotify() { from="$(sed -n "/^From:/ s|From: *|| p" "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" - notify "📧$from:" "$subject" + message_id=$(sed -n 's/^Message-ID: *\(<.*>\)$/\1/p' "$file") + ACTION=$(notify "📧$from:" "$subject" --action="open=Open email" "📧$from:" "$subject") + case "$ACTION" in + open) + if [ -n "$message_id" ]; then + $TERMINAL -e neomutt -f "$XDG_DATA_HOME/mail/$2/INBOX" -e "'push L~i$message_id\n\n'" + else + $TERMINAL -e neomutt -f "$XDG_DATA_HOME/mail/$2/INBOX" + fi + ;; + *) + echo "No valid action selected" + ;; + esac done ;; *) echo "No new mail for $2." ;; From f1b248ab0345c67d54b105dd7fade8503b891d74 Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 22 Jul 2025 23:46:49 +0200 Subject: [PATCH 2/2] Update mailsync --- bin/mailsync | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/mailsync b/bin/mailsync index bdda018..3e30300 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -19,7 +19,7 @@ pgrep mbsync >/dev/null && { echo "mbsync is already running."; exit ;} # files for variable assignments. This is ugly, but there are few options that # will work on the maximum number of machines. eval "$(grep -h -- \ - "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|PASSWORD_STORE_GPG_OPTS\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \ + "^\s*\(export \)\?\(MBSYNCRC\|MPOPRC\|PASSWORD_STORE_DIR\|PASSWORD_STORE_GPG_OPTS\|NOTMUCH_CONFIG\|GNUPGHOME\|MAILSYNC_MUTE\|TERMINAL\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \ "$HOME/.profile" "$HOME/.bash_profile" "$HOME/.zprofile" "$HOME/.config/zsh/.zprofile" "$HOME/.zshenv" \ "$HOME/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ "$HOME/.pam_environment" 2>/dev/null)"