Mercurial > emacs
annotate lisp/notifications.el @ 110428:6060b86fc551
Merge changes made in Gnus trunk.
nnimap.el (nnimap-finish-retrieve-group-infos): Return data in the nntp buffer so the agent can save it.
nnimap.el (nnimap-open-shell-stream): Bind `process-connection-type' to nil, so that CRLF doesn't get translated to \n; (nnimap-open-connection): Don't make 'shell commands only send \n.
nnimap.el (nnimap-request-group): Don't make `M-g' bug out on group with no marks.
gnus-agent.el (gnus-agent-load-alist): Nix out the alist if the file doesn't exist.
nnimap.el (nnimap-finish-retrieve-group-infos): Protect against groups that have no articles.
nnimap.el (nnimap-request-article): Check that we really got an article when we requested one.
gnus-html.el (gnus-html-schedule-image-fetching): Ignore all errors from url-retrieve, for instance about invalid URLs.
gnus-agent.el: Change default of gnus-agent-auto-agentize-methods to nil.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sun, 19 Sep 2010 10:45:51 +0000 |
parents | 14e479cda1d2 |
children | 6358797a47cd f215ea324ebd |
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 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3 ;; Copyright (C) 2010 Free Software Foundation, Inc. |
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 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
98 (dbus-register-signal |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
99 :session |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
100 notifications-service |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
101 notifications-path |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
102 notifications-interface |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
103 notifications-action-signal |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
104 'notifications-on-action-signal) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
105 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
106 (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
|
107 "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
|
108 (let ((entry (assoc id notifications-on-close-map))) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
109 (when entry |
108964
da553d450193
* net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents:
108925
diff
changeset
|
110 (funcall (cadr entry) |
da553d450193
* net/notifications.el (notifications-on-action-signal)
Michael Albinus <michael.albinus@gmx.de>
parents:
108925
diff
changeset
|
111 id (cadr (assoc reason notifications-closed-reason))) |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
112 (remove entry 'notifications-on-close-map)))) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
113 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
114 (dbus-register-signal |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
115 :session |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
116 notifications-service |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
117 notifications-path |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
118 notifications-interface |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
119 notifications-closed-signal |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
120 'notifications-on-closed-signal) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
121 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
122 (defun notifications-notify (&rest params) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
123 "Send notification via D-Bus using the Freedesktop notification protocol. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
124 Various PARAMS can be set: |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
125 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
126 :title The notification title. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
127 :body The notification body text. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
128 :app-name The name of the application sending the notification. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
129 Default to `notifications-application-name'. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
130 :replaces-id The notification ID that this notification replaces. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
131 :app-icon The notification icon. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
132 Default is `notifications-application-icon'. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
133 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
|
134 :actions A list of actions in the form: |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
135 (KEY TITLE KEY TITLE ...) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
136 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
|
137 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
|
138 notification) should have a key named \"default\". |
108925
515ffffc30e6
* net/notifications.el (notifications-notify): Fix docstring.
Michael Albinus <albinus@detlef>
parents:
108920
diff
changeset
|
139 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
|
140 not to display it. |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
141 :timeout The timeout time in milliseconds since the display |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
142 of the notification at which the notification should |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
143 automatically close. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
144 If -1, the notification's expiration time is dependent |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
145 on the notification server's settings, and may vary for |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
146 the type of notification. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
147 If 0, the notification never expires. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
148 Default value is -1. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
149 :urgency The urgency level. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
150 Either `low', `normal' or `critical'. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
151 :category The type of notification this is. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
152 :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
|
153 the calling program. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
154 :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
|
155 height, rowstride, has alpha, bits per sample, channels and |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
156 image data respectively. |
110316
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
157 :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
|
158 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
|
159 in a freedesktop.org-compliant icon theme. |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
160 :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
|
161 :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
|
162 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
|
163 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
|
164 be \"message-new-instant\". |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
165 :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
|
166 that ability. |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
167 :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
|
168 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
|
169 :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
|
170 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
|
171 :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
|
172 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
|
173 as arguments to the function. |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
174 :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
|
175 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
|
176 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
|
177 reason as arguments: |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
178 - `expired' if the notification has expired |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
179 - `dismissed' if the notification was dismissed by the user |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
180 - `close-notification' if the notification was closed |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
181 by a call to CloseNotification |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
182 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
183 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
|
184 used to manipulate the notification item with |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
185 `notifications-close'." |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
186 (let ((title (plist-get params :title)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
187 (body (plist-get params :body)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
188 (app-name (plist-get params :app-name)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
189 (replaces-id (plist-get params :replaces-id)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
190 (app-icon (plist-get params :app-icon)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
191 (actions (plist-get params :actions)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
192 (timeout (plist-get params :timeout)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
193 ;; Hints |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
194 (hints '()) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
195 (urgency (plist-get params :urgency)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
196 (category (plist-get params :category)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
197 (desktop-entry (plist-get params :desktop-entry)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
198 (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
|
199 (image-path (plist-get params :image-path)) |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
200 (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
|
201 (sound-name (plist-get params :sound-name)) |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
202 (suppress-sound (plist-get params :suppress-sound)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
203 (x (plist-get params :x)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
204 (y (plist-get params :y)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
205 id) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
206 ;; Build hints array |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
207 (when urgency |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
208 (add-to-list 'hints `(:dict-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
209 "urgency" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
210 (:variant :byte ,(case urgency |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
211 ('low 0) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
212 ('critical 2) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
213 (t 1)))) t)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
214 (when category |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
215 (add-to-list 'hints `(:dict-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
216 "category" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
217 (:variant :string ,category)) t)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
218 (when desktop-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
219 (add-to-list 'hints `(:dict-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
220 "desktop-entry" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
221 (:variant :string ,desktop-entry)) t)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
222 (when image-data |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
223 (add-to-list 'hints `(:dict-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
224 "image_data" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
225 (:variant :struct ,image-data)) t)) |
110316
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
226 (when image-path |
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
227 (add-to-list 'hints `(:dict-entry |
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
228 "image_path" |
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
229 (:variant :string ,image-path)) t)) |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
230 (when sound-file |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
231 (add-to-list 'hints `(:dict-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
232 "sound-file" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
233 (:variant :string ,sound-file)) t)) |
110316
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
234 (when sound-name |
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
235 (add-to-list 'hints `(:dict-entry |
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
236 "sound-name" |
14e479cda1d2
* notifications.el (notifications-notify): Add support for
Michael Albinus <michael.albinus@gmx.de>
parents:
108965
diff
changeset
|
237 (:variant :string ,sound-name)) t)) |
108916
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
238 (when suppress-sound |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
239 (add-to-list 'hints `(:dict-entry |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
240 "suppress-sound" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
241 (:variant :boolean ,suppress-sound)) t)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
242 (when x |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
243 (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
|
244 (when y |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
245 (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
|
246 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
247 ;; Call Notify method |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
248 (setq id |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
249 (dbus-call-method :session |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
250 notifications-service |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
251 notifications-path |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
252 notifications-interface |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
253 notifications-notify-method |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
254 :string (or app-name |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
255 notifications-application-name) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
256 :uint32 (or replaces-id 0) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
257 :string (if app-icon |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
258 (expand-file-name app-icon) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
259 ;; If app-icon is nil because user |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
260 ;; requested it to be so, send the |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
261 ;; empty string |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
262 (if (plist-member params :app-icon) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
263 "" |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
264 ;; Otherwise send the default icon path |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
265 notifications-application-icon)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
266 :string (or title "") |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
267 :string (or body "") |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
268 `(:array ,@actions) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
269 (or hints '(:array :signature "{sv}")) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
270 :int32 (or timeout -1))) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
271 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
272 ;; Register close/action callback function |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
273 (let ((on-action (plist-get params :on-action)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
274 (on-close (plist-get params :on-close))) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
275 (when on-action |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
276 (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
|
277 (when on-close |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
278 (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
|
279 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
280 ;; Return notification id |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
281 id)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
282 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
283 (defun notifications-close-notification (id) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
284 "Close a notification with identifier ID." |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
285 (dbus-call-method :session |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
286 notifications-service |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
287 notifications-path |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
288 notifications-interface |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
289 notifications-close-notification-method |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
290 :int32 id)) |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
291 |
f0e5fbe77b7c
* notifications.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
292 (provide 'notifications) |