diff options
| author | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-27 04:16:50 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-27 04:16:50 +0530 |
| commit | 0981b6c089b483b4ecddceeffe89ed3f38561fb2 (patch) | |
| tree | 9b947b3a6840d26d7a95a5fbee46afaf488a505a /modules/communication/neomutt/neomutt-sync-daemon.sh | |
| parent | 80c2906ed127b9f5024d7c8b8f8aa663a5eb4c31 (diff) | |
| download | home-manager-config-0981b6c089b483b4ecddceeffe89ed3f38561fb2.tar.gz home-manager-config-0981b6c089b483b4ecddceeffe89ed3f38561fb2.zip | |
feat(communication/neomutt): the first sync after opening neomutt is quick
Diffstat (limited to 'modules/communication/neomutt/neomutt-sync-daemon.sh')
| -rw-r--r-- | modules/communication/neomutt/neomutt-sync-daemon.sh | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/modules/communication/neomutt/neomutt-sync-daemon.sh b/modules/communication/neomutt/neomutt-sync-daemon.sh index d148567..301eb98 100644 --- a/modules/communication/neomutt/neomutt-sync-daemon.sh +++ b/modules/communication/neomutt/neomutt-sync-daemon.sh @@ -1,16 +1,17 @@ #!/usr/bin/env bash -# systemd daemon: full-sync the -full channels every 10 minutes while -# neomutt is open. Started/stopped by the wrapped neomutt launcher. +# systemd daemon: sync quick channels on first run, then full channels every 10 minutes +# while neomutt is open. Started/stopped by the wrapped neomutt launcher. set -uo pipefail INTERVAL="$((10 * 60))" MBSYNCRC="${MBSYNCRC:-$HOME/.config/mbsync/.mbsyncrc}" -if [[ $# -eq 0 ]]; then - echo "Usage: $0 <mbsync-channel> [channel...]" >&2 - exit 2 -fi +QUICK_CHANNELS_STR="@@QUICK_CHANNELS@@" +FULL_CHANNELS_STR="@@FULL_CHANNELS@@" + +IFS=',' read -ra QUICK_CHANNELS <<<"$QUICK_CHANNELS_STR" +IFS=',' read -ra FULL_CHANNELS <<<"$FULL_CHANNELS_STR" sync_once() { echo "Syncing: $*" @@ -26,8 +27,15 @@ sync_once() { notmuch new --quiet } +first_run=true + while true; do - sync_once "$@" + if [[ $first_run == true ]]; then + sync_once "${QUICK_CHANNELS[@]}" + first_run=false + else + sync_once "${FULL_CHANNELS[@]}" + fi # Safety net: the launcher stops this service when neomutt exits; if that # didn't happen (hard kill), bail out once neomutt is gone. |
