#!/usr/bin/env sh # -*- mode: scheme; -*- IFS=" " exec scsh -o thread-fluids -s "$0" "$@" !# ;; Copyright (C) 2022 Tom Willemse ;; This program is free software: you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free Software ;; Foundation, either version 3 of the License, or (at your option) any later ;; version. ;; This program is distributed in the hope that it will be useful, but WITHOUT ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ;; details. ;; You should have received a copy of the GNU General Public License along with ;; this program. If not, see . (if (exec-path-search "notmuch" (thread-fluid exec-path-list)) (display (run/sexp (notmuch count tag:inbox and tag:unread))) (begin (let* ((mail-root (string-append (getenv "HOME") "/documents/mail")) (unread-emails (run/sexp (pipe (find ,mail-root -type f -name "*:2,*" -and -not -name "*:2,*S*") (wc -l)))) (new-emails (run/sexp (pipe (find ,mail-root -type f -wholename "*/new/*") (wc -l))))) (display (+ unread-emails new-emails)))))