| @@ -12,7 +12,7 @@ ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; e | |||||
| command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." | command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script." | ||||
| # Required to display notifications if run as a cronjob: | # Required to display notifications if run as a cronjob: | ||||
| DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus | |||||
| export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus | |||||
| export DISPLAY=:0.0 | export DISPLAY=:0.0 | ||||
| # For individual configurations: | # For individual configurations: | ||||
| @@ -30,7 +30,7 @@ fi | |||||
| # Check account for new mail. Notify if there is new content. | # Check account for new mail. Notify if there is new content. | ||||
| syncandnotify() { | syncandnotify() { | ||||
| acc="$(echo "$account" | sed "s/.*\///")" | acc="$(echo "$account" | sed "s/.*\///")" | ||||
| mbsync $opts "$acc" | |||||
| mbsync "$opts" "$acc" | |||||
| 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 "$HOME/.config/mutt/.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 | ||||