diff --git a/home/programs/neomutt.nix b/home/programs/neomutt.nix index 2301364..a0c3ccd 100644 --- a/home/programs/neomutt.nix +++ b/home/programs/neomutt.nix @@ -31,11 +31,13 @@ }; imapnotify = { enable = true; - boxes = ["Inbox" "Inbox/Servius" "Inbox/Hardware" "Inbox/Uber"]; + boxes = ["INBOX" "INBOX/Servius" "INBOX/Hardware" "INBOX/Uber"]; onNotify = "${pkgs.writeShellScript "mbsync-notify" '' - ${pkgs.isync}/bin/mbsync $1 - ${pkgs.notmuch}/bin/notmuch new - ${pkgs.libnotify}/bin/notify-send "New Mail" "New email in $1" + ${pkgs.isync}/bin/mbsync "fastmail:$1" + added=$(${pkgs.notmuch}/bin/notmuch new | ${pkgs.gnugrep}/bin/grep -oP 'Added \K[0-9]+' || echo 0) + if [ "$added" -gt 0 ]; then + ${pkgs.libnotify}/bin/notify-send "New Mail" "$added new email(s) in $1" + fi ''} %s"; }; }; @@ -45,11 +47,13 @@ }; imapnotify = { enable = true; - boxes = ["Inbox"]; + boxes = ["INBOX"]; onNotify = "${pkgs.writeShellScript "mbsync-notify" '' - ${pkgs.isync}/bin/mbsync $1 - ${pkgs.notmuch}/bin/notmuch new - ${pkgs.libnotify}/bin/notify-send "New Mail" "New email in $1" + ${pkgs.isync}/bin/mbsync "gmail:$1" + added=$(${pkgs.notmuch}/bin/notmuch new | ${pkgs.gnugrep}/bin/grep -oP 'Added \K[0-9]+' || echo 0) + if [ "$added" -gt 0 ]; then + ${pkgs.libnotify}/bin/notify-send "New Mail" "$added new email(s) in $1" + fi ''} %s"; }; };