From d15576c4592b9db52b0c6441116eb57439b4b92c Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Fri, 19 Jul 2024 16:23:04 -0700 Subject: neomutt wrapper scrip to mbsync before and after --- home/xyz/.config/neomutt/neomuttrc | 13 +++++++++++++ home/xyz/.local/bin/neomutt | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100755 home/xyz/.local/bin/neomutt (limited to 'home') diff --git a/home/xyz/.config/neomutt/neomuttrc b/home/xyz/.config/neomutt/neomuttrc index f4d88ff6..7c8d6b81 100644 --- a/home/xyz/.config/neomutt/neomuttrc +++ b/home/xyz/.config/neomutt/neomuttrc @@ -91,6 +91,19 @@ set mail_check=60 # no ask auto save to draft set postpone='yes' +# need echo here to run an external shell command, see https://neomutt.org/feature/global-hooks +# startup-hook works, but I'm not confidient with it because shutdown-hook is buggy, see below. Because I'll need a wrapper script for mbsync after shutdown, I decided to just use a wrapper script for mbsync before startup also for now +#startup-hook 'echo `mbsync -a`' +# I decided not to use timeout-hook and shutdown-hook hooks due to its issues with mbsync, see below +# timeout-hook and shutdown-hook configured with startup-hook will cause timeout-hook and shutdown-hook mbsync not working? see https://github.com/neomutt/neomutt/issues/3298 , my experience is shutdown-hook's mbsync not working, not sure how to test timeout-hook +# somehow `sleep 1; mbsync -a` works? +# maybe related: https://github.com/neomutt/neomutt/issues/4184 https://github.com/neomutt/neomutt/pull/4200 +# more bug notes see vq +# consider I may use another email client to access remote email mailboxes, sync when shutdown so those other email client can get latest changes +#shutdown-hook 'echo `mbsync -a`' +# I don't understand timeout-hook and $timeout very well, but seems useful, $timeout default 600 seconds, so maybe it sync every 600s +#timeout-hook 'echo `mbsync -a`' + set query_command="abook --mutt-query '%s'" # https://neomutt.org/guide/advancedusage#8-%C2%A0external-address-queries # completion when ask for address input diff --git a/home/xyz/.local/bin/neomutt b/home/xyz/.local/bin/neomutt new file mode 100755 index 00000000..53d28ac5 --- /dev/null +++ b/home/xyz/.local/bin/neomutt @@ -0,0 +1,7 @@ +#!/bin/sh + +# neomutt shutdown-hook is buggy with mbsync, so I decided to use a wrapper script instead +# more see neomuttrc and vq bug notes +mbsync -a +/usr/bin/neomutt "$@" +mbsync -a -- cgit v1.2.3-70-g09d2