Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

41 Zeilen
1.4 KiB

  1. #!/usr/bin/env sh
  2. # This script will run mbsync and check
  3. # for new email if there is an internet connection.
  4. #
  5. # If it detects new mail, it uses mpv to play a
  6. # notification sound: notify.opus
  7. #
  8. # I have this run as a cronjob every 5 minutes.
  9. # Checks for internet connection and set notification script.
  10. ping -q -c 1 1.1.1.1 > /dev/null || exit
  11. export DISPLAY=:0.0
  12. # Settings are different for MacOS (Darwin) systems.
  13. if [ "$(uname)" = "Darwin" ]; then
  14. notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
  15. else
  16. notify() { paplay "$HOME/.config/mutt/bin/notify.ogg" & pgrep -x dunst && notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
  17. fi
  18. echo " 🔃" > /tmp/imapsyncicon
  19. pkill -RTMIN+12 i3blocks
  20. # Run mbsync. You can feed this script different settings.
  21. mbsync -a "$@"
  22. rm -f /tmp/imapsyncicon
  23. pkill -RTMIN+12 i3blocks
  24. # Check all accounts/mailboxes for new mail. Notify if there is new content.
  25. for account in "$HOME/.local/share/mail/"*
  26. do
  27. acc="$(echo "$account" | sed "s/.*\///")"
  28. newcount=$(find "$HOME/.local/share/mail/$acc/INBOX/new/" -type f -newer "$HOME/.config/mutt/bin/.mailsynclastrun" 2> /dev/null | wc -l)
  29. [ "$newcount" -gt "0" ] && notify "$acc" "$newcount" &
  30. done
  31. notmuch new 2>/dev/null
  32. #Create a touch file that indicates the time of the last run of mailsync
  33. touch "$HOME/.config/mutt/bin/.mailsynclastrun"