commit e3f8e19775e592757a62ed5319fa90652fb9e910 parent 7ddff8d77b9792ba744f4a7ad00e4b3e8316bb5e Author: awy <awy@awy.one> Date: Tue, 6 Jan 2026 20:49:18 +0300 nofitication actions (open / reply to / delete current message) Diffstat:
| M | bin/mailsync | | | 41 | +++++++++++++++++++++++++++++++++++++++-- |
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/bin/mailsync b/bin/mailsync @@ -67,7 +67,44 @@ Darwin) notify() { osascript -e "display notification \"$2\" with title \"$1\""; esac notify() { - notify-send --app-name="aerc-wizard" -- "$1" "$2" + if [ -n "$3" ]; then + ACTION=$(notify-send \ + --action="default=Open email" \ + --action="reply=Reply to email" \ + --action="delete=Delete email" \ + --app-name="aerc-wizard" -- "$1" "$2") + spawn_aerc() { + if ! pgrep -x aerc >/dev/null; then + # No aerc running, start it + setsid -f "$TERMINAL" -e aerc >/dev/null + until pgrep -x aerc >/dev/null; do + sleep 0.1 + done + fi + } + case "$ACTION" in + default) + spawn_aerc + setsid -wf aerc :change-tab "$4" >/dev/null + setsid -wf aerc :eml "$3" >/dev/null + ;; + reply) + spawn_aerc + setsid -wf aerc :change-tab "$4" >/dev/null + setsid -wf aerc :eml "$3" >/dev/null + setsid -f aerc :reply -q >/dev/null + ;; + delete) + spawn_aerc + setsid -wf aerc :change-tab "$4" >/dev/null + setsid -wf aerc :eml "$3" >/dev/null + setsid -f aerc :move Trash >/dev/null + ;; + *) ;; + esac + else + notify-send --app-name="aerc-wizard" -- "$1" "$2" + fi } ;; esac @@ -100,7 +137,7 @@ syncandnotify() { from="${from% *}" from="${from%\"}" from="${from#\"}" - notify "📧$from:" "$subject" + notify "📧$from:" "$subject" "$file" "$2" done ;; *) echo "No new mail for $2." ;;