Browse Source

Merge pull request #630 from dgrisham/impl/mutt-config-xdg

Update mailsync to check XDG_CONFIG_HOME for mutt config dir
tags/3.2.1
Luke Smith 3 years ago
committed by GitHub
parent
commit
158f28b294
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      bin/mailsync

+ 4
- 2
bin/mailsync View File

@@ -33,6 +33,8 @@ case "$(readlink -f /sbin/init)" in
esac esac
export GPG_TTY=$TTY export GPG_TTY=$TTY


muttconfig="${XDG_CONFIG_HOME:-$HOME/.config}/mutt"

[ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc" [ -n "$MBSYNCRC" ] && alias mbsync="mbsync -c $MBSYNCRC" || MBSYNCRC="$HOME/.mbsyncrc"


# Settings are different for MacOS (Darwin) systems. # Settings are different for MacOS (Darwin) systems.
@@ -58,7 +60,7 @@ esac
syncandnotify() { syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")" acc="$(echo "$account" | sed "s/.*\///")"
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null)
new=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" "$HOME/.local/share/mail/$acc/Inbox/new/" "$HOME/.local/share/mail/$acc/inbox/new/" -type f -newer "$muttconfig/.mailsynclastrun" 2> /dev/null)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then if [ "$newcount" -gt "0" ]; then
notify "$acc" "$newcount" & notify "$acc" "$newcount" &
@@ -91,4 +93,4 @@ wait
notmuch new 2>/dev/null notmuch new 2>/dev/null


#Create a touch file that indicates the time of the last run of mailsync #Create a touch file that indicates the time of the last run of mailsync
touch "$HOME/.config/mutt/.mailsynclastrun"
touch "$muttconfig/.mailsynclastrun"

Loading…
Cancel
Save