[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 42a911c61e6 1/2: notifications: Allow to use Icon Naming Specific
|
From: |
Michael Albinus |
|
Subject: |
master 42a911c61e6 1/2: notifications: Allow to use Icon Naming Specification for app-icon |
|
Date: |
Thu, 27 Jul 2023 10:54:37 -0400 (EDT) |
branch: master
commit 42a911c61e67caa807750cd40887b729f09aaf52
Author: Andrew Tropin <andrew@trop.in>
Commit: Michael Albinus <michael.albinus@gmx.de>
notifications: Allow to use Icon Naming Specification for app-icon
* doc/lispref/os.texi (Desktop Notifications): Extend meaning of
:app-icon.
* etc/NEWS: Allow to use Icon Naming Specification for app-icon in
notifications-notify.
* lisp/notifications.el (notifications-notify): Allow to use Icon
Naming Specification for app-icon.
---
doc/lispref/os.texi | 7 +++++++
etc/NEWS | 10 ++++++++++
lisp/notifications.el | 11 ++++++++++-
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 4bcc9d5fea6..ebedfe82087 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2885,6 +2885,13 @@ must be the result of a previous
@code{notifications-notify} call.
@item :app-icon @var{icon-file}
The file name of the notification icon. If set to @code{nil}, no icon
is displayed. The default is @code{notifications-application-icon}.
+If the value is a string, the function interprets it as a file name
+and converts to absolute by using @code{expand-file-name}; if it is a
+symbol, the function will use its name (which is useful when using the
+Icon Naming Specification @footnote{For more information about icon
+naming convention see
+@uref{https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html,
+Icon Naming Specification}}).
@item :actions (@var{key} @var{title} @var{key} @var{title} ...)
A list of actions to be applied. @var{key} and @var{title} are both
diff --git a/etc/NEWS b/etc/NEWS
index d0dab755212..44ffbaf78f2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -567,6 +567,16 @@ Similarly to buffer restoration by Desktop, 'recentf-mode'
checking
of the accessibility of remote files can now time out if
'remote-file-name-access-timeout' is set to a positive number.
+** Notifications
+
++++
+*** Allow to use Icon Naming Specification for app-icon
+You can use a symbol as the value for ':app-icon' to provide icon name
+without specifying a file, like this:
+
+ (notifications-notify
+ :title "I am playing music" :app-icon 'multimedia-player)
+
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/notifications.el b/lisp/notifications.el
index 984ddbec5e9..a694b38e52e 100644
--- a/lisp/notifications.el
+++ b/lisp/notifications.el
@@ -137,6 +137,12 @@ Various PARAMS can be set:
:app-icon The notification icon.
Default is `notifications-application-icon'.
Set to nil if you do not want any icon displayed.
+ If the value is a string, the function
+ interprets it as a file name and converts to
+ absolute by using `expand-file-name'; if it is a
+ symbol, the function will use its name (which is
+ useful when using the Icon Naming
+ Specification).
:actions A list of actions in the form:
(KEY TITLE KEY TITLE ...)
where KEY and TITLE are both strings.
@@ -304,7 +310,10 @@ of another `notifications-notify' call."
notifications-application-name)
:uint32 (or replaces-id 0)
:string (if app-icon
- (expand-file-name app-icon)
+ (if (stringp app-icon)
+ (expand-file-name app-icon)
+ ;; Convert symbol to string
+ (symbol-name app-icon))
;; If app-icon is nil because user
;; requested it to be so, send the
;; empty string
| [Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 42a911c61e6 1/2: notifications: Allow to use Icon Naming Specification for app-icon,
Michael Albinus <=