Discard OSC 9 notifications that start with 4;

Some misguided software is using it for "progress reporting". OSC 9 has
a decade plus history of being used for notifications but because
Windows Terminal decided to use it for progress reporting, without
bothering to do research about conflicting existing uses, systemd of all
things wants to adopt it!! Crazy world we live in.

Since actual notifications are highly unlikely to start with 4; we
hopefully don't break any real world use cases and also don't let
systemd spam our users with endless notifications.

Fixes #8011
This commit is contained in:
Kovid Goyal 2024-11-01 20:15:15 +05:30
parent 15b5a9cfbd
commit 847433dba2
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 0 deletions

View file

@ -84,6 +84,11 @@ consumption to do the same tasks.
Detailed list of changes
-------------------------------------
0.37.1 [future]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Discard OSC 9 notifications that start with :code:`4;` because some misguided software is using it for "progress reporting" (:iss:`8011`)
0.37.0 [2024-10-30]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -1095,6 +1095,13 @@ def desktop_notify(self, osc_code: int, raw_datab: memoryview) -> None:
log_error(f'Ignoring unknown OSC 777: {raw_data}')
return # unknown OSC 777
raw_data = raw_data[len('notify;'):]
if osc_code == 9 and raw_data.startswith('4;'):
# This is probably the Windows Terminal "progress reporting" conflicting
# implementation which sadly some thoughtless people have
# implemented in unix CLI programs. So ignore it rather than
# spamming the user with continuous notifications. See for example:
# https://github.com/kovidgoyal/kitty/issues/8011
return
get_boss().notification_manager.handle_notification_cmd(self.id, osc_code, raw_data)
def on_mouse_event(self, event: dict[str, Any]) -> bool: