Skip to content

Commit

Permalink
Discard OSC 9 notifications that start with 4;
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kovidgoyal committed Nov 1, 2024
1 parent 15b5a9c commit 847433d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
7 changes: 7 additions & 0 deletions kitty/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 847433d

Please sign in to comment.