From 7000e2f946ff9ba51fc3631825cf4c17ae064232 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 28 Nov 2025 13:13:04 +0000 Subject: darwin: better way of getting app badge --- custom/jao-custom-notmuch.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'custom') diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index e093ed4..89bd217 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -26,6 +26,8 @@ (defsubst jao-notmuch--qstr (c) (format "%s%s" (plist-get c :name) (plist-get c :count))) +(defvar jao-notmuch-mac-xbar t) + (defun jao-notmuch-xbar () (let ((cnts (notmuch-hello-query-counts jao-notmuch-xbar-queries))) (jao-shell-exec (format "echo '%s | color=#8b3626 | size=11' >/tmp/xbar" @@ -33,7 +35,10 @@ (defun jao-notmuch-notify () (interactive) - (let ((cnts (notmuch-hello-query-counts jao-notmuch-minibuffer-queries))) + (let* ((cnts (notmuch-hello-query-counts jao-notmuch-minibuffer-queries)) + (mc (jao-d-l + (unless jao-notmuch-mac-xbar (jao-mac-app-badge "Mail")) 0)) + (cnts (if (> (or mc 0) 0) (cons `(:name "" :count ,mc) cnts) cnts))) (setq jao-notmuch-minibuffer-string (mapconcat (lambda (c) (propertize (jao-notmuch--qstr c) @@ -41,7 +46,7 @@ 'jao-themes-dimm))) cnts " ")) - (jao-when-darwin (jao-notmuch-xbar)) + (jao-when-darwin (when jao-notmuch-mac-xbar (jao-notmuch-xbar))) (jao-minibuffer-refresh))) (defun jao-notmuch-notify-and-update () -- cgit v1.2.3