mail.lisp 992 B

12345678910111213141516171819202122232425262728293031323334
  1. (in-package :stumpwm)
  2. (defun fetch-mail-command (command)
  3. (format nil "sh -c 'TMOUT=20; echo \"Fetch mail.\"; ~a; notify-send \"Mail fetched.\"; read -p \"Press Enter to close.\"'"
  4. command))
  5. (defcommand mjru-mbsync () ()
  6. (term-shell-command (fetch-mail-command "mbsync -a majordomo")
  7. :title "mjru-mbsync"
  8. :font '("-fa" "Monospace" "-fs" "8")
  9. :color "dark"))
  10. (defcommand notmuch () ()
  11. (term-shell-command (fetch-mail-command "notmuch new")
  12. :title "notmuch"
  13. :terminal 'st
  14. :font "Monospace:size=8"
  15. :color "dark"))
  16. (defvar *notmuch-job* nil)
  17. (defcommand toggle-notmuch-job () ()
  18. (if *notmuch-job*
  19. (setf *notmuch-job* nil)
  20. (setf *notmuch-job* t)))
  21. (defcommand notmuch-job () ()
  22. (sb-thread:make-thread
  23. (lambda ()
  24. (loop while *notmuch-job* do (progn (notmuch) (sleep 3600))))
  25. :name "notmuch"))