diff options
author | jao <jao@gnu.org> | 2025-10-21 18:32:40 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2025-10-21 18:32:40 +0100 |
commit | e2994e5b61cdf566bba8371c020d4a78a2533508 (patch) | |
tree | ef3ce6da0ced9253d7a74e31ff116a84925e6db2 | |
parent | f888699ccc44ad1b5b9be4c20febbb6cacc346e7 (diff) | |
download | elibs-e2994e5b61cdf566bba8371c020d4a78a2533508.tar.gz elibs-e2994e5b61cdf566bba8371c020d4a78a2533508.tar.bz2 |
gnus: notifications for xbar
-rw-r--r-- | custom/jao-custom-gnus.el | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el index 597ad70..597ef85 100644 --- a/custom/jao-custom-gnus.el +++ b/custom/jao-custom-gnus.el @@ -680,21 +680,14 @@ (directory-files mail-source-directory nil "feeds\\.[^e]") (seq-difference '("feeds.trove" "feeds.emacs" "feeds.emacs-devel"))))) - `( - ;; ("nnml:bigml\\.inbox" "B" jao-themes-f00) - ;; ("nnml:bigml\\.alba" "A" jao-themes-f00) - ;; ("nnml:bigml\\.ryou" "R" jao-themes-f00) - ;; ("nnml:bigml\\.bugs" "b" jao-themes-error) - ;; ("nnml:bigml\\.support" "S" default) - ;; ("nnml:bigml\\.[^aibsr]" "W" jao-themes-dimm) - ("nnml:jao\\.bigml" "B" jao-themes-f00) + `(("nnml:jao\\.bigml" "B" jao-themes-f00) ("nnml:jao\\.\\(inbox\\|trove\\)" "I" jao-themes-f01) - ("nnml:jao.hunting" "H" jao-themes-f02) ("nnml:jao.write" "W" jao-themes-warning) ("nnml:jao.[^ithwb]" "J" jao-themes-dimm) - ("nnml:jao.hacking" "J" jao-themes-dimm) - (,(format "^nnml:%s" (regexp-opt feeds)) "F" jao-themes-dimm) - ("feeds\\.emacs" "E" jao-themes-dimm) + ("nnml:jao.hacking" "H" jao-themes-dimm) + ;; (,(format "^nnml:%s" (regexp-opt feeds)) "F" jao-themes-dimm) + ;; ("feeds\\.emacs" "E" jao-themes-dimm) + ("nnml:feeds\\." "F" jao-themes-dimm) ("nnml:local" "l" jao-themes-dimm) ("nnrss:.*" "R" jao-themes-dimm) ("^\\(gwene\\|gmane\\)\\." "N" jao-themes-dimm)))) @@ -723,28 +716,20 @@ (defvar jao-gnus--notify-strs ()) -(defun jao-gnus--nnw-count () - (jao-when-darwin - (when-let* ((n (jao-nnw-unread-count))) - (when (> n 0) (list (format "(%s)" n)))))) - -(defun jao-gnus-xbar () - (let ((n (jao-gnus-unread-count))) - (concat (if (> n 0) (format "%s " n) "") - (or (car (jao-gnus--nnw-count)) "")))) +(defun jao-gnus--xbar-echo (labels) + (jao-shell-exec + (let* ((ls (mapconcat (lambda (x) (plist-get x :propertize)) labels " ")) + (m (when ls (format "%s | color=#8b3626 | size=11" ls)))) + (format "echo '%s' >/tmp/xbar" (or m " "))))) (defun jao-gnus--notify-strs () (let* ((all (jao-gnus--unread-counts)) (counts (cdr all)) - (total (car all))) - (jao-when-darwin - (jao-shell-exec - (format "echo '%s | color=%s' >/tmp/xbar" - total (if (> total 0) "#8b3626" "#efefef")))) - (seq-filter #'identity - (seq-map (lambda (args) - (apply 'jao-gnus--unread-label counts args)) - jao-gnus-tracked-groups)))) + (labels (seq-keep (lambda (args) + (apply 'jao-gnus--unread-label counts args)) + jao-gnus-tracked-groups))) + (jao-when-darwin (jao-gnus--xbar-echo labels)) + labels)) (defun jao-gnus--notify () (setq jao-gnus--notify-strs (jao-gnus--notify-strs)) |