diff options
| author | Andrew Tropin | 2023-07-27 16:43:17 +0200 |
|---|---|---|
| committer | Michael Albinus | 2023-07-27 16:43:17 +0200 |
| commit | 42a911c61e67caa807750cd40887b729f09aaf52 (patch) | |
| tree | b3af85c6de4cf3665e81ec700a8669890e70ce8c | |
| parent | 184fc9b0200cf991c250bb3d6b158eaea2ee7806 (diff) | |
| download | emacs-42a911c61e67caa807750cd40887b729f09aaf52.tar.gz emacs-42a911c61e67caa807750cd40887b729f09aaf52.zip | |
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.
| -rw-r--r-- | doc/lispref/os.texi | 7 | ||||
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lisp/notifications.el | 11 |
3 files changed, 27 insertions, 1 deletions
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. | |||
| 2885 | @item :app-icon @var{icon-file} | 2885 | @item :app-icon @var{icon-file} |
| 2886 | The file name of the notification icon. If set to @code{nil}, no icon | 2886 | The file name of the notification icon. If set to @code{nil}, no icon |
| 2887 | is displayed. The default is @code{notifications-application-icon}. | 2887 | is displayed. The default is @code{notifications-application-icon}. |
| 2888 | If the value is a string, the function interprets it as a file name | ||
| 2889 | and converts to absolute by using @code{expand-file-name}; if it is a | ||
| 2890 | symbol, the function will use its name (which is useful when using the | ||
| 2891 | Icon Naming Specification @footnote{For more information about icon | ||
| 2892 | naming convention see | ||
| 2893 | @uref{https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html, | ||
| 2894 | Icon Naming Specification}}). | ||
| 2888 | 2895 | ||
| 2889 | @item :actions (@var{key} @var{title} @var{key} @var{title} ...) | 2896 | @item :actions (@var{key} @var{title} @var{key} @var{title} ...) |
| 2890 | A list of actions to be applied. @var{key} and @var{title} are both | 2897 | A list of actions to be applied. @var{key} and @var{title} are both |
| @@ -567,6 +567,16 @@ Similarly to buffer restoration by Desktop, 'recentf-mode' checking | |||
| 567 | of the accessibility of remote files can now time out if | 567 | of the accessibility of remote files can now time out if |
| 568 | 'remote-file-name-access-timeout' is set to a positive number. | 568 | 'remote-file-name-access-timeout' is set to a positive number. |
| 569 | 569 | ||
| 570 | ** Notifications | ||
| 571 | |||
| 572 | +++ | ||
| 573 | *** Allow to use Icon Naming Specification for app-icon | ||
| 574 | You can use a symbol as the value for ':app-icon' to provide icon name | ||
| 575 | without specifying a file, like this: | ||
| 576 | |||
| 577 | (notifications-notify | ||
| 578 | :title "I am playing music" :app-icon 'multimedia-player) | ||
| 579 | |||
| 570 | 580 | ||
| 571 | * New Modes and Packages in Emacs 30.1 | 581 | * New Modes and Packages in Emacs 30.1 |
| 572 | 582 | ||
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: | |||
| 137 | :app-icon The notification icon. | 137 | :app-icon The notification icon. |
| 138 | Default is `notifications-application-icon'. | 138 | Default is `notifications-application-icon'. |
| 139 | Set to nil if you do not want any icon displayed. | 139 | Set to nil if you do not want any icon displayed. |
| 140 | If the value is a string, the function | ||
| 141 | interprets it as a file name and converts to | ||
| 142 | absolute by using `expand-file-name'; if it is a | ||
| 143 | symbol, the function will use its name (which is | ||
| 144 | useful when using the Icon Naming | ||
| 145 | Specification). | ||
| 140 | :actions A list of actions in the form: | 146 | :actions A list of actions in the form: |
| 141 | (KEY TITLE KEY TITLE ...) | 147 | (KEY TITLE KEY TITLE ...) |
| 142 | where KEY and TITLE are both strings. | 148 | where KEY and TITLE are both strings. |
| @@ -304,7 +310,10 @@ of another `notifications-notify' call." | |||
| 304 | notifications-application-name) | 310 | notifications-application-name) |
| 305 | :uint32 (or replaces-id 0) | 311 | :uint32 (or replaces-id 0) |
| 306 | :string (if app-icon | 312 | :string (if app-icon |
| 307 | (expand-file-name app-icon) | 313 | (if (stringp app-icon) |
| 314 | (expand-file-name app-icon) | ||
| 315 | ;; Convert symbol to string | ||
| 316 | (symbol-name app-icon)) | ||
| 308 | ;; If app-icon is nil because user | 317 | ;; If app-icon is nil because user |
| 309 | ;; requested it to be so, send the | 318 | ;; requested it to be so, send the |
| 310 | ;; empty string | 319 | ;; empty string |