Also respond about urgency support in the query response

This commit is contained in:
Kovid Goyal 2024-07-23 20:24:18 +05:30
parent 36a3b33b02
commit 3cf6db445b
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 8 additions and 3 deletions

View file

@ -115,12 +115,16 @@ implementation supports. Currently, the following keys are defined:
Key Value
======= ================================================================================
``a`` Comma separated list of actions from the ``a`` key that the terminal
implements. If no actions are supported, the ``a`` key must be absent form the
implements. If no actions are supported, the ``a`` key must be absent from the
query response.
``o`` Comma separated list of occassions from the ``o`` key that the
terminal implements. If no occassions are supported, the value
``o=always`` must be sent in the query response.
``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.
======= ================================================================================
In the future, if this protocol expands, more keys might be added. Clients must

View file

@ -143,7 +143,8 @@ def parse_osc_99(raw: str) -> NotificationCommand:
if metadata == '?':
actions = ','.join(x.name for x in Action)
when = ','.join(x.name for x in OnlyWhen if x.value)
raise QueryResponse(f'99;?;a={actions}:o={when}')
urgency = ','.join(str(x.value) for x in Urgency)
raise QueryResponse(f'99;?;a={actions}:o={when}:u={urgency}')
payload_is_encoded = False
payload_type = 'title'
if metadata:

View file

@ -590,7 +590,7 @@ def activated(identifier, window_id, focus, report):
reset()
h('?')
self.assertFalse(notifications)
self.ae(query_responses, ['99;?;a=focus,report:o=always,unfocused,invisible'])
self.ae(query_responses, ['99;?;a=focus,report:o=always,unfocused,invisible:u=0,1,2'])
def test_dcs_codes(self):
s = self.create_screen()