I use GNU Emacs 30.1 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.65 Version 12.7.6 (Build 21H1320)) of 2025年02月24日. I suppose macOS doesn't support dbus.
Notification error: (dbus-error "Emacs not compiled with dbus support") #23
I think the issue is I was showing notifications with emacs builtin notifications-notify which requires dbus. I made a mac-os-notifications branch, entirely untested as a don't have a mac to test with. Can you check if it fixes the dbus error and notifications work? To quickly test rather than waiting for opencode to show some notification you can run:
(opencode--toast-show '((title . "some title")
(message . "some message")
(variant . "info")
(duration . 3000)))
There is no dbus error now, but I don't get any response. I'm testing more.
It would be great if the notification system could accept a function/hook so users can plug in their own notifier (e.g., terminal-notifier) without advising internal functions. I’m currently doing this on macOS:
(defun my-opencode--toast-via-terminal-notifier (orig-fun properties)
"Use terminal-notifier for OpenCode toast on macOS."
(let-alist properties
(if (and (eq system-type 'darwin)
(executable-find "terminal-notifier"))
(let* ((bundle-id "org.gnu.Emacs")
(args (list "-title" (or .title "")
"-message" (or .message "")
"-group" "opencode-toast"
"-activate" bundle-id
"-sound" "glass")))
(when (member .variant '("error" "warning"))
(setq args (append args (list "-sound" "default"))))
(apply #'call-process "terminal-notifier" nil 0 nil args))
(funcall orig-fun properties))))
(advice-add 'opencode--toast-show :around #'my-opencode--toast-via-terminal-notifier)
I added a variable opencode-toast-function you can customize to set the notification function. I also tried to make it when running on darwin, if terminal-notifier is present, default to using that based on your function, and otherwise try to show notifications with osascript -e "display notification...". But I don't have a mac, can you test if the new code works?
I tested it on macOS, and it seems to be working fine now! Thank you. This tool is truly fantastic, and I really support what you’re doing.
image
It works now.
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?