djcb / sauron

emacs event log (WIP)
226 stars 27 forks source link

sauron and dbus #49

Open MaksVal opened 8 years ago

MaksVal commented 8 years ago

Hi! Thanks for your work!

I tried your module, with dbus. But I have a trouble with it. Redefine modules: (setq sauron-modules '(sauron-dbus sauron-org sauron-notifications))

And please, look at: 2016-05-31 09:09:02 sauron 3 sauron started: sauron-org, sauron-notifications

Where is dbus? Sauron didn't listen dbus? I saw my message in dbus-monitor program... Emacs 24.5.1, sauron: elpa/sauron-20160501.1045/ Thanks!

djcb commented 8 years ago

Hmm, that should work; the module should show up there, even if it didn't work. Anything mentioned in your message buffer? And does it work after you restart emacs / sauron with this variable in your config?

MaksVal commented 8 years ago

I using emacs in daemon mode. I start the module with this command: sauron-start.

This is my config:

(require 'sauron)

(global-set-key (kbd "C-c s") 'sauron-toggle-hide-show)
(global-set-key (kbd "C-c t") 'sauron-clear)

(setq
 sauron-modules '(sauron-dbus sauron-org sauron-notifications))

(setq
  sauron-max-line-length 120

  sauron-separate-frame nil
  sauron-watch-patterns
  '("emacs-fu" "emacsfu" "wombat" "capybara" "yak" "gnu" "\\bmu\\b" "mail")

(add-hook 'sauron-event-added-functions
  (lambda (origin prio msg &optional props)
    (if (string-match "ping" msg)
      (sauron-fx-sox "/usr/share/sounds/ping.wav"))
    (cond
      ((= prio 3) (sauron-fx-sox "/usr/share/sounds/pop.wav"))
      ((= prio 4) (sauron-fx-sox "/usr/share/sounds/pop.wav"))
      ((= prio 5)
    (sauron-fx-sox "/usr/share/sounds/pop.wav")
    (sauron-fx-gnome-osd(format "%S: %s" origin msg) 5)))))

;; events to ignore
(add-hook 'sauron-event-block-functions
  (lambda (origin prio msg &optional props)
    (or
     (string-match "^*** Users" msg)))) ;; filter out IRC spam

(setq sauron-dbus-cookie t)

(provide 'config-sauron)

The Message buffer is clean. This is content in the buffer: 2016-07-25 09:16:44 sauron 3 sauron started: sauron-org, sauron-notifications

djcb commented 6 years ago

Most likely you've started emacs (ie., the daemon) in an environment without a dbus session. What does (getenv "DBUS_SESSION_BUS_ADDRESS") say?

troublew commented 6 years ago

Hie, I'm having trouble too using dbus. I've rightfully started dbus, and launched emacs with "dbus-launch --exit-with-session emacs". When I test (getenv "DBUS_SESSION_BUS_ADDRESS"), I get: "unix:abstract=/tmp/dbus-HL8k3Ba2Qy,guid=0c6062be5651ffb8213076e85a9131de". But I still can't use the exemples you provide. When I try one, I get in dbus-monitor --session:

error time=1519465200.330796 sender=org.freedesktop.DBus -> destination=:1.22 error_name=org.freedesktop.DBus.Error.ServiceUnknown reply_serial=2
   string "The name org.gnu.Emacs was not provided by any .service files"

When I try (dbus-list-names :session), I get: ("org.freedesktop.DBus" ":1.0" "org.gnu.Emacs") When I try (dbus-list-activatable-names :session), I get: ("org.freedesktop.DBus" "org.gtk.GLib.PACRunner" "org.a11y.Bus")

I don't understand what is the problem. I'm running gentoo. Maybe is it a permission problem? I can't find what is the path where the services are registered in.

djcb commented 6 years ago

Was your emacs built with DBus support?

troublew commented 6 years ago

After all that time, I came back to check the problem again, and that was a problem of permission. I have "umask 022" and it broke a lot of packages, including dbus. Sorry for the issue, I was in fault since the beginning. Thanks a lot of the extension.