unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Show notifications using Emacs' notifications-notify under Sway
@ 2024-01-17  1:53 Rodrigo Morales
  2024-01-17 17:32 ` Fredrik Salomonsson
  0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Morales @ 2024-01-17  1:53 UTC (permalink / raw)
  To: help-guix


I'm using Sway as my windows manager under Guix SD

I can show notifications using =dunstify=

#+BEGIN_SRC sh
dunstify 'Title of the notification' 'Body of the notification'
#+END_SRC

When I try to show notifications using Emacs through the
=notifications-notify= function (see first code block below), I get the
following error (see second code block below)

#+BEGIN_SRC elisp
(notifications-notify
 :timeout 3000
 :title "title"
 :body "body")
#+END_SRC

#+CAPTION: Buffer *Backtrace*
#+BEGIN_SRC text
Debugger entered--Lisp error: (dbus-error "No connection to bus" :session)
  dbus-message-internal(1 :session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" dbus-call-method-handler :string "Emacs" :uint32 0 :string "/gnu/store/9k0c9iija60rax5fwcss6v7ywzzzg438-emacs-..." :string "title" :string "body" (:array) (:array :signature "{sv}") :int32 3000)
  apply(dbus-message-internal 1 :session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" dbus-call-method-handler (:string "Emacs" :uint32 0 :string "/gnu/store/9k0c9iija60rax5fwcss6v7ywzzzg438-emacs-..." :string "title" :string "body" (:array) (:array :signature "{sv}") :int32 3000))
  dbus-call-method(:session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" :string "Emacs" :uint32 0 :string "/gnu/store/9k0c9iija60rax5fwcss6v7ywzzzg438-emacs-..." :string "title" :string "body" (:array) (:array :signature "{sv}") :int32 3000)
  notifications-notify(:timeout 3000 :title "title" :body "body")
  (let ((print-level nil) (print-length nil)) (notifications-notify :timeout 3000 :title "title" :body "body"))
  (setq elisp--eval-defun-result (let ((print-level nil) (print-length nil)) (notifications-notify :timeout 3000 :title "title" :body "body")))
  elisp--eval-defun()
  #<subr eval-defun>(nil)
  edebug--eval-defun(#<subr eval-defun> nil)
  apply(edebug--eval-defun #<subr eval-defun> nil)
  eval-defun(nil)
  funcall-interactively(eval-defun nil)
  command-execute(eval-defun)
#+END_SRC

I have 2 questions:

1. Does anyone know how to troubleshoot this error?
2. Are you able to notifications through Emacs using notifications-notify
   under Sway?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Show notifications using Emacs' notifications-notify under Sway
  2024-01-17  1:53 Show notifications using Emacs' notifications-notify under Sway Rodrigo Morales
@ 2024-01-17 17:32 ` Fredrik Salomonsson
  0 siblings, 0 replies; 2+ messages in thread
From: Fredrik Salomonsson @ 2024-01-17 17:32 UTC (permalink / raw)
  To: Rodrigo Morales, help-guix

Hi,

Rodrigo Morales <me@rodrigomorales.site> writes:

> I'm using Sway as my windows manager under Guix SD
>
> I can show notifications using =dunstify=
>
> #+BEGIN_SRC sh
> dunstify 'Title of the notification' 'Body of the notification'
> #+END_SRC
>
> When I try to show notifications using Emacs through the
> =notifications-notify= function (see first code block below), I get the
> following error (see second code block below)
>
> #+BEGIN_SRC elisp
> (notifications-notify
>  :timeout 3000
>  :title "title"
>  :body "body")
> #+END_SRC
>
> #+CAPTION: Buffer *Backtrace*
> #+BEGIN_SRC text
> Debugger entered--Lisp error: (dbus-error "No connection to bus" :session)
>   dbus-message-internal(1 :session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" dbus-call-method-handler :string "Emacs" :uint32 0 :string "/gnu/store/9k0c9iija60rax5fwcss6v7ywzzzg438-emacs-..." :string "title" :string "body" (:array) (:array :signature "{sv}") :int32 3000)
>   apply(dbus-message-internal 1 :session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" dbus-call-method-handler (:string "Emacs" :uint32 0 :string "/gnu/store/9k0c9iija60rax5fwcss6v7ywzzzg438-emacs-..." :string "title" :string "body" (:array) (:array :signature "{sv}") :int32 3000))
>   dbus-call-method(:session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" :string "Emacs" :uint32 0 :string "/gnu/store/9k0c9iija60rax5fwcss6v7ywzzzg438-emacs-..." :string "title" :string "body" (:array) (:array :signature "{sv}") :int32 3000)
>   notifications-notify(:timeout 3000 :title "title" :body "body")
>   (let ((print-level nil) (print-length nil)) (notifications-notify :timeout 3000 :title "title" :body "body"))
>   (setq elisp--eval-defun-result (let ((print-level nil) (print-length nil)) (notifications-notify :timeout 3000 :title "title" :body "body")))
>   elisp--eval-defun()
>   #<subr eval-defun>(nil)
>   edebug--eval-defun(#<subr eval-defun> nil)
>   apply(edebug--eval-defun #<subr eval-defun> nil)
>   eval-defun(nil)
>   funcall-interactively(eval-defun nil)
>   command-execute(eval-defun)
> #+END_SRC
>
> I have 2 questions:
>
> 1. Does anyone know how to troubleshoot this error?

I'm not sure how to troubleshoot this.  But it looks like it cannot
connect to dbus.  Do you have one running for your user?  Not sure if
`dunstify` uses dbus or not.  

> 2. Are you able to notifications through Emacs using notifications-notify
>    under Sway?

Yes, running your elisp snippet on my machine works as expected.  I'm
running `mako` via [guix home][0] instead of `dunst`.  I have a dbus
instance running as [my user][1].  And I'm running a [dbus command][2]
when launching sway to setup the some envirionment variables for dbus to
work with sway.  Maybe these can help?

[0] https://git.sr.ht/~plattfot/plt/tree/master/item/plt/home/mako.scm
[1] https://git.sr.ht/~plattfot/plt/tree/master/item/plt/home/sway.scm#L144
[2] https://git.sr.ht/~plattfot/plt/tree/master/item/plt/home/services.scm#L55

-- 
s/Fred[re]+i[ck]+/Fredrik/g


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-17 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17  1:53 Show notifications using Emacs' notifications-notify under Sway Rodrigo Morales
2024-01-17 17:32 ` Fredrik Salomonsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).