emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v3] notifications: Allow to use Icon Naming Specification for app


From: Andrew Tropin
Subject: [PATCH v3] notifications: Allow to use Icon Naming Specification for app-icon
Date: Wed, 26 Jul 2023 15:59:48 +0400

Icon is not always a file name, but can be just an icon name.
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

* lisp/notifications.el (notifications-notify): Allow to use Icon
Naming Specification for app-icon.
---
Changes since v2: updated NEWS and os.texi.
 doc/lispref/os.texi   | 3 +++
 etc/NEWS              | 7 +++++++
 lisp/notifications.el | 8 +++++++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 4bcc9d5fea6..efa89fa387c 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2885,6 +2885,9 @@ Desktop Notifications
 @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 value is a string @code{expand-file-name} will be applied, if value
+is a symbol it will be used as is (helpful when using 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 5883b4df2a7..e1a5cbf0340 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -548,6 +548,13 @@ 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.
+Symbol can be used as a value for :app-icon to provide icon name
+without specifying a file.
+

 * New Modes and Packages in Emacs 30.1
 
diff --git a/lisp/notifications.el b/lisp/notifications.el
index 984ddbec5e9..13353264de3 100644
--- a/lisp/notifications.el
+++ b/lisp/notifications.el
@@ -137,6 +137,9 @@ notifications-notify
  :app-icon       The notification icon.
                  Default is `notifications-application-icon'.
                  Set to nil if you do not want any icon displayed.
+                 If value is a string expand-file-name will be
+                 applied, if value is a symbol it will be used as
+                 is (helpful when using Icon Naming Specification).
  :actions        A list of actions in the form:
                    (KEY TITLE KEY TITLE ...)
                  where KEY and TITLE are both strings.
@@ -304,7 +307,10 @@ notifications-notify
                                          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
-- 
2.41.0

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]