From db6f62a749c33d4cf322f0dd794e9ddbc254f7cb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 23 Jul 2024 21:42:00 +0530 Subject: [PATCH] Desktop notifications protocol: Add support for closing previous notifications Feel free to comment if you have concerns. Not yet implemented in kitty. Fixes #7659 --- docs/changelog.rst | 2 ++ docs/desktop-notifications.rst | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 4a07c5f47..3278359a7 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -110,6 +110,8 @@ Detailed list of changes - Desktop notifications protocol: Add support for querying if the terminal emulator supports the protocol (:iss:`7658`) +- Desktop notifications protocol: Add support for closing previous notifications (:iss:`7659`) + 0.35.2 [2024-06-22] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/desktop-notifications.rst b/docs/desktop-notifications.rst index 8277e4722..56186978e 100644 --- a/docs/desktop-notifications.rst +++ b/docs/desktop-notifications.rst @@ -93,6 +93,24 @@ to display it based on what it does understand. Similarly, features such as scheduled notifications could be added in future revisions. +Closing an existing notification +---------------------------------- + +.. versionadded:: 0.36.0 + The ability to close a previous notification was added in kitty 0.36.0 + +To close a previous notification, send:: + + i= : p=close ; + +This will close a previous notification with the specified id. If closing +succeeds, the terminal will send an escape code of the form:: + + i= : p=close ; + +Closing is done on a best effort basis so applications must not rely on the +delivery of the closed escape code. + Querying for support ------------------------- @@ -128,6 +146,10 @@ Key Value ``u`` Comma separated list of urgency values that the terminal implements. If urgency is not supported, the ``u`` key must be absent from the query response. + +``p`` Comma spearated list of supported payload types (i.e. values of the + ``p`` key that the terminal implements). These must contain at least + ``title`` and ``body``. ======= ================================================================================ In the future, if this protocol expands, more keys might be added. Clients must @@ -156,8 +178,8 @@ Key Value Default Description direct responses to the correct window. ``p`` One of ``title``, ``title`` Whether the payload is the notification title or body or query. If a - ``body`` or ``?`` notification has no title, the body will be used as title. Terminal - emulators should ignore payloads of unknown type to allow for future + ``body``, ``close`` notification has no title, the body will be used as title. Terminal + , ``?`` emulators should ignore payloads of unknown type to allow for future expansion of this protocol. ``o`` One of ``always``, ``always`` When to honor the notification request. ``unfocused`` means when the window