3
43
Fork
You've already forked opencode.el
16

Notification error: (dbus-error "Emacs not compiled with dbus support") #23

Closed
opened 2026年02月12日 05:14:01 +01:00 by veer66 · 6 comments

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.

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.
Owner
Copy link

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)))
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))) ```
Author
Copy link

There is no dbus error now, but I don't get any response. I'm testing more.

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)
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: ```elisp (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)
Owner
Copy link

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 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

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](/attachments/b30a7318-49d2-43aa-956b-a816d706522a)
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sczi/opencode.el#23
Reference in a new issue
sczi/opencode.el
No description provided.
Delete branch "%!s()"

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?