| @@ -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 | # files for variable assignments. This is ugly, but there are few options that | ||||
| # will work on the maximum number of machines. | # will work on the maximum number of machines. | ||||
| eval "$(grep -h -- \ | 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/.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/.config/zsh/.zshenv" "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.config/zsh/.zshrc" \ | ||||
| "$HOME/.pam_environment" 2>/dev/null)" | "$HOME/.pam_environment" 2>/dev/null)" | ||||
| @@ -80,7 +80,20 @@ syncandnotify() { | |||||
| from="$(sed -n "/^From:/ s|From: *|| p" "$file" | | from="$(sed -n "/^From:/ s|From: *|| p" "$file" | | ||||
| perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)')" | ||||
| from="${from% *}" ; from="${from%\"}" ; from="${from#\"}" | 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 | done | ||||
| ;; | ;; | ||||
| *) echo "No new mail for $2." ;; | *) echo "No new mail for $2." ;; | ||||