From 847433dba2271031cd7d58025022eef10a668072 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Nov 2024 20:15:15 +0530 Subject: [PATCH] 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 --- docs/changelog.rst | 5 +++++ kitty/window.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 8f17106a9..f83a91e4d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/window.py b/kitty/window.py index d0b130bdf..005dffd73 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -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: