annotate lisp/notifications.el @ 112281:697cfa263439

info-xref.el Version 3. * lisp/info-xref.el (info-xref-check, info-xref-check-all): Move commentary details into docstrings for better visibility. Use compilation-mode for the results buffer. (info-xref-output, info-xref-output-error, info-xref-with-output) (info-xref-filename, info-xref-in-progress): New internals for this. (info-xref-check-list, info-xref-check-buffer) (info-xref-check-all-custom): Use those. (info-xref-output-buffer): Rename from info-xref-results-buffer. (info-xref-output-heading): Rename from info-xref-filename-heading. (info-xref-good, info-xref-bad, info-xref-xfile-alist) (info-xref-filename-heading): Move to output managing section. (info-xref-docstrings): New command checking "Info node `(foo)Bar'" (info-xref-lock-file-p, info-xref-with-file): New helpers for it. (info-xref-subfile-p): Move to generic section with those two. (info-xref-check-node): New function split from info-xref-check-buffer, shared by info-xref-docstrings. (info-xref-goto-node-p): Move to a checking section with that func. (info-xref-unavail): New counter. (info-xref-check-node): Use it. (info-xref-with-output): Show count of unavailables at end of output. (info-xref-all-info-files): Exclude ".*" dotfiles. Ignore broken symlinks. Exclude .texi files. Exclude Emacs backup files. (info-xref-check-all-custom): Fix quietening viper-mode and gnus-registry-install -- use setq not let so as not to unbind after load.
author Glenn Morris <rgm@gnu.org>
date Sat, 15 Jan 2011 17:59:33 -0800
parents 6378d1b57038
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
1 ;;; notifications.el --- Client interface to desktop notifications.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
2
112275
6378d1b57038 Add 2011 to remaining FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 110581
diff changeset
3 ;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
4
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
5 ;; Author: Julien Danjou <julien@danjou.info>
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
6 ;; Keywords: comm desktop notifications
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
7
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
9
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
13 ;; (at your option) any later version.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
14
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
18 ;; GNU General Public License for more details.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
19
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
22
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
23 ;;; Commentary:
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
24
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
25 ;; This package provides an implementation of the Desktop Notifications
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
26 ;; <http://www.galago-project.org/specs/notification/>.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
27
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
28 ;; In order to activate this package, you must add the following code
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
29 ;; into your .emacs:
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
30 ;;
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
31 ;; (require 'notifications)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
32
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
33 ;;; Code:
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
34 (eval-when-compile
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
35 (require 'cl))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
36
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
37 ;; Pacify byte-compiler. D-Bus support in the Emacs core can be
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
38 ;; disabled with configuration option "--without-dbus". Declare used
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
39 ;; subroutines and variables of `dbus' therefore.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
40 (declare-function dbus-call-method "dbusbind.c")
108920
838873812c0a * net/notifications.el (dbus-register-signal): Declare function.
Juanma Barranquero <lekktu@gmail.com>
parents: 108918
diff changeset
41 (declare-function dbus-register-signal "dbusbind.c")
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
42
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
43 (require 'dbus)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
44
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
45 (defconst notifications-specification-version "1.1"
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
46 "The version of the Desktop Notifications Specification implemented.")
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
47
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
48 (defconst notifications-application-name "Emacs"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
49 "Default application name.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
50
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
51 (defconst notifications-application-icon
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
52 (expand-file-name
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
53 "images/icons/hicolor/scalable/apps/emacs.svg"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
54 data-directory)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
55 "Default application icon.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
56
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
57 (defconst notifications-service "org.freedesktop.Notifications"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
58 "D-Bus notifications service name.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
59
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
60 (defconst notifications-path "/org/freedesktop/Notifications"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
61 "D-Bus notifications service path.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
62
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
63 (defconst notifications-interface "org.freedesktop.Notifications"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
64 "D-Bus notifications service path.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
65
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
66 (defconst notifications-notify-method "Notify"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
67 "D-Bus notifications service path.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
68
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
69 (defconst notifications-close-notification-method "CloseNotification"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
70 "D-Bus notifications service path.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
71
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
72 (defconst notifications-action-signal "ActionInvoked"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
73 "D-Bus notifications action signal.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
74
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
75 (defconst notifications-closed-signal "NotificationClosed"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
76 "D-Bus notifications closed signal.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
77
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
78 (defconst notifications-closed-reason
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
79 '((1 expired)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
80 (2 dismissed)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
81 (3 close-notification)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
82 (4 undefined))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
83 "List of reasons why a notification has been closed.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
84
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
85 (defvar notifications-on-action-map nil
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
86 "Mapping between notification and action callback functions.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
87
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
88 (defvar notifications-on-close-map nil
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
89 "Mapping between notification and close callback functions.")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
90
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
91 (defun notifications-on-action-signal (id action)
108964
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
92 "Dispatch signals to callback functions from `notifications-on-action-map'."
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
93 (let ((entry (assoc id notifications-on-action-map)))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
94 (when entry
108964
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
95 (funcall (cadr entry) id action)
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
96 (remove entry 'notifications-on-action-map))))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
97
110581
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
98 (when (fboundp 'dbus-register-signal)
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
99 (dbus-register-signal
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
100 :session
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
101 notifications-service
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
102 notifications-path
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
103 notifications-interface
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
104 notifications-action-signal
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
105 'notifications-on-action-signal))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
106
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
107 (defun notifications-on-closed-signal (id reason)
108964
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
108 "Dispatch signals to callback functions from `notifications-on-closed-map'."
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
109 (let ((entry (assoc id notifications-on-close-map)))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
110 (when entry
108964
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
111 (funcall (cadr entry)
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
112 id (cadr (assoc reason notifications-closed-reason)))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
113 (remove entry 'notifications-on-close-map))))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
114
110581
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
115 (when (fboundp 'dbus-register-signal)
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
116 (dbus-register-signal
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
117 :session
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
118 notifications-service
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
119 notifications-path
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
120 notifications-interface
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
121 notifications-closed-signal
f215ea324ebd * lisp/notifications.el: Call dbus-register-signal only if it is bound.
Glenn Morris <rgm@gnu.org>
parents: 110316
diff changeset
122 'notifications-on-closed-signal))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
123
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
124 (defun notifications-notify (&rest params)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
125 "Send notification via D-Bus using the Freedesktop notification protocol.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
126 Various PARAMS can be set:
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
127
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
128 :title The notification title.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
129 :body The notification body text.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
130 :app-name The name of the application sending the notification.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
131 Default to `notifications-application-name'.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
132 :replaces-id The notification ID that this notification replaces.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
133 :app-icon The notification icon.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
134 Default is `notifications-application-icon'.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
135 Set to nil if you do not want any icon displayed.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
136 :actions A list of actions in the form:
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
137 (KEY TITLE KEY TITLE ...)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
138 where KEY and TITLE are both strings.
108920
838873812c0a * net/notifications.el (dbus-register-signal): Declare function.
Juanma Barranquero <lekktu@gmail.com>
parents: 108918
diff changeset
139 The default action (usually invoked by clicking the
838873812c0a * net/notifications.el (dbus-register-signal): Declare function.
Juanma Barranquero <lekktu@gmail.com>
parents: 108918
diff changeset
140 notification) should have a key named \"default\".
108925
515ffffc30e6 * net/notifications.el (notifications-notify): Fix docstring.
Michael Albinus <albinus@detlef>
parents: 108920
diff changeset
141 The title can be anything, though implementations are free
108920
838873812c0a * net/notifications.el (dbus-register-signal): Declare function.
Juanma Barranquero <lekktu@gmail.com>
parents: 108918
diff changeset
142 not to display it.
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
143 :timeout The timeout time in milliseconds since the display
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
144 of the notification at which the notification should
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
145 automatically close.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
146 If -1, the notification's expiration time is dependent
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
147 on the notification server's settings, and may vary for
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
148 the type of notification.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
149 If 0, the notification never expires.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
150 Default value is -1.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
151 :urgency The urgency level.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
152 Either `low', `normal' or `critical'.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
153 :category The type of notification this is.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
154 :desktop-entry This specifies the name of the desktop filename representing
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
155 the calling program.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
156 :image-data This is a raw data image format which describes the width,
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
157 height, rowstride, has alpha, bits per sample, channels and
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
158 image data respectively.
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
159 :image-path This is represented either as a URI (file:// is the
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
160 only URI schema supported right now) or a name
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
161 in a freedesktop.org-compliant icon theme.
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
162 :sound-file The path to a sound file to play when the notification pops up.
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
163 :sound-name A themeable named sound from the freedesktop.org sound naming
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
164 specification to play when the notification pops up.
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
165 Similar to icon-name,only for sounds. An example would
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
166 be \"message-new-instant\".
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
167 :suppress-sound Causes the server to suppress playing any sounds, if it has
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
168 that ability.
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
169 :x Specifies the X location on the screen that the notification
108920
838873812c0a * net/notifications.el (dbus-register-signal): Declare function.
Juanma Barranquero <lekktu@gmail.com>
parents: 108918
diff changeset
170 should point to. The \"y\" hint must also be specified.
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
171 :y Specifies the Y location on the screen that the notification
108920
838873812c0a * net/notifications.el (dbus-register-signal): Declare function.
Juanma Barranquero <lekktu@gmail.com>
parents: 108918
diff changeset
172 should point to. The \"x\" hint must also be specified.
108964
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
173 :on-action Function to call when an action is invoked.
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
174 The notification id and the key of the action are passed
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
175 as arguments to the function.
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
176 :on-close Function to call when the notification has been closed
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
177 by timeout or by the user.
108964
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
178 The function receive the notification id and the closing
da553d450193 * net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents: 108925
diff changeset
179 reason as arguments:
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
180 - `expired' if the notification has expired
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
181 - `dismissed' if the notification was dismissed by the user
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
182 - `close-notification' if the notification was closed
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
183 by a call to CloseNotification
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
184
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
185 This function returns a notification id, an integer, which can be
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
186 used to manipulate the notification item with
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
187 `notifications-close'."
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
188 (let ((title (plist-get params :title))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
189 (body (plist-get params :body))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
190 (app-name (plist-get params :app-name))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
191 (replaces-id (plist-get params :replaces-id))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
192 (app-icon (plist-get params :app-icon))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
193 (actions (plist-get params :actions))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
194 (timeout (plist-get params :timeout))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
195 ;; Hints
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
196 (hints '())
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
197 (urgency (plist-get params :urgency))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
198 (category (plist-get params :category))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
199 (desktop-entry (plist-get params :desktop-entry))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
200 (image-data (plist-get params :image-data))
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
201 (image-path (plist-get params :image-path))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
202 (sound-file (plist-get params :sound-file))
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
203 (sound-name (plist-get params :sound-name))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
204 (suppress-sound (plist-get params :suppress-sound))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
205 (x (plist-get params :x))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
206 (y (plist-get params :y))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
207 id)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
208 ;; Build hints array
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
209 (when urgency
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
210 (add-to-list 'hints `(:dict-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
211 "urgency"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
212 (:variant :byte ,(case urgency
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
213 ('low 0)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
214 ('critical 2)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
215 (t 1)))) t))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
216 (when category
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
217 (add-to-list 'hints `(:dict-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
218 "category"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
219 (:variant :string ,category)) t))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
220 (when desktop-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
221 (add-to-list 'hints `(:dict-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
222 "desktop-entry"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
223 (:variant :string ,desktop-entry)) t))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
224 (when image-data
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
225 (add-to-list 'hints `(:dict-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
226 "image_data"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
227 (:variant :struct ,image-data)) t))
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
228 (when image-path
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
229 (add-to-list 'hints `(:dict-entry
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
230 "image_path"
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
231 (:variant :string ,image-path)) t))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
232 (when sound-file
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
233 (add-to-list 'hints `(:dict-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
234 "sound-file"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
235 (:variant :string ,sound-file)) t))
110316
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
236 (when sound-name
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
237 (add-to-list 'hints `(:dict-entry
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
238 "sound-name"
14e479cda1d2 * notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents: 108965
diff changeset
239 (:variant :string ,sound-name)) t))
108916
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
240 (when suppress-sound
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
241 (add-to-list 'hints `(:dict-entry
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
242 "suppress-sound"
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
243 (:variant :boolean ,suppress-sound)) t))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
244 (when x
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
245 (add-to-list 'hints `(:dict-entry "x" (:variant :int32 ,x)) t))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
246 (when y
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
247 (add-to-list 'hints `(:dict-entry "y" (:variant :int32 ,y)) t))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
248
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
249 ;; Call Notify method
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
250 (setq id
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
251 (dbus-call-method :session
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
252 notifications-service
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
253 notifications-path
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
254 notifications-interface
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
255 notifications-notify-method
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
256 :string (or app-name
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
257 notifications-application-name)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
258 :uint32 (or replaces-id 0)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
259 :string (if app-icon
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
260 (expand-file-name app-icon)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
261 ;; If app-icon is nil because user
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
262 ;; requested it to be so, send the
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
263 ;; empty string
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
264 (if (plist-member params :app-icon)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
265 ""
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
266 ;; Otherwise send the default icon path
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
267 notifications-application-icon))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
268 :string (or title "")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
269 :string (or body "")
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
270 `(:array ,@actions)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
271 (or hints '(:array :signature "{sv}"))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
272 :int32 (or timeout -1)))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
273
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
274 ;; Register close/action callback function
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
275 (let ((on-action (plist-get params :on-action))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
276 (on-close (plist-get params :on-close)))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
277 (when on-action
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
278 (add-to-list 'notifications-on-action-map (list id on-action)))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
279 (when on-close
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
280 (add-to-list 'notifications-on-close-map (list id on-close))))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
281
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
282 ;; Return notification id
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
283 id))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
284
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
285 (defun notifications-close-notification (id)
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
286 "Close a notification with identifier ID."
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
287 (dbus-call-method :session
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
288 notifications-service
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
289 notifications-path
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
290 notifications-interface
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
291 notifications-close-notification-method
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
292 :int32 id))
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
293
f0e5fbe77b7c * notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
294 (provide 'notifications)