[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: notifications-notify resets idle-time
From: |
Peter Münster |
Subject: |
Re: notifications-notify resets idle-time |
Date: |
Sun, 04 Mar 2012 22:24:14 +0100 |
User-agent: |
Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.0.93 (gnu/linux) |
On Tue, Feb 14 2012, Michael Albinus wrote:
>>> Wouldn't it suffice just to deregister signal "NotificationClosed"?
>>
>> How? With dbus-unregister-service?
>
> Yes.
It seems, that I rather need dbus-unregister-object, because I only want
to unregister the closed-signal, not the action-signal. So I patched
notifications.el:
--8<---------------cut here---------------start------------->8---
--- notifications.el~ 2012-03-04 22:00:27.851590759 +0100
+++ notifications.el 2012-03-04 22:00:43.625016422 +0100
@@ -96,6 +96,12 @@
This must be kept, because the notification daemon could be
restarted, and the registered signals cannot be identified anymore.")
+(defvar notifications-action-signal-object nil
+ "Object of the registration of the action signal.")
+
+(defvar notifications-closed-signal-object nil
+ "Object of the registration of the closed signal.")
+
(defun notifications-on-action-signal (id action)
"Dispatch signals to callback functions from `notifications-on-action-map'."
(let ((entry (assoc id notifications-on-action-map)))
@@ -106,13 +112,14 @@
(remove entry 'notifications-on-action-map))))
(when (fboundp 'dbus-register-signal)
- (dbus-register-signal
- :session
- nil
- notifications-path
- notifications-interface
- notifications-action-signal
- 'notifications-on-action-signal))
+ (setq notifications-action-signal-object
+ (dbus-register-signal
+ :session
+ nil
+ notifications-path
+ notifications-interface
+ notifications-action-signal
+ 'notifications-on-action-signal)))
(defun notifications-on-closed-signal (id &optional reason)
"Dispatch signals to callback functions from `notifications-on-closed-map'."
@@ -128,13 +135,14 @@
(remove entry 'notifications-on-close-map))))
(when (fboundp 'dbus-register-signal)
- (dbus-register-signal
- :session
- nil
- notifications-path
- notifications-interface
- notifications-closed-signal
- 'notifications-on-closed-signal))
+ (setq notifications-closed-signal-object
+ (dbus-register-signal
+ :session
+ nil
+ notifications-path
+ notifications-interface
+ notifications-closed-signal
+ 'notifications-on-closed-signal)))
(defun notifications-notify (&rest params)
"Send notification via D-Bus using the Freedesktop notification protocol.
--8<---------------cut here---------------end--------------->8---
And in my init.el I do now:
--8<---------------cut here---------------start------------->8---
(require 'notifications)
(dbus-unregister-object notifications-closed-signal-object)
--8<---------------cut here---------------end--------------->8---
> I have played with the other woraround option, reusing the notification
> window. The following code snippet, based on your initial example, shall
> give you an idea:
I understand: instead of closing the window, you replace it by another
and no event is sent to emacs. But it does not really fit my needs:
Now I use https://github.com/p-m/org-notify with a personal setup that
opens notification pop-ups once per minute with a timeout of 10 seconds
for example.
--
Peter
- Re: notifications-notify resets idle-time,
Peter Münster <=