help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Show notifications using Emacs' notifications-notify under Sway


From: Fredrik Salomonsson
Subject: Re: Show notifications using Emacs' notifications-notify under Sway
Date: Wed, 17 Jan 2024 17:32:53 +0000

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]