diff --git a/docs/changelog.rst b/docs/changelog.rst index 2d5af9870..f98afa8e0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -139,6 +139,8 @@ Detailed list of changes - When dragging in rectangle select mode use a crosshair mouse cursor configurable via :opt:`pointer_shape_when_dragging` +- macOS: Fix waiting for result from desktop notification not working (:disc:`8379`) + 0.39.1 [2025-02-01] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/cocoa_window.m b/kitty/cocoa_window.m index 1e46817a3..8c61083eb 100644 --- a/kitty/cocoa_window.m +++ b/kitty/cocoa_window.m @@ -438,7 +438,7 @@ ident_in_list_of_notifications(NSString *ident, NSArray *list) void cocoa_report_live_notifications(const char* ident) { - do_notification_callback(ident, "live", ""); + do_notification_callback(ident, "live", ident ? ident : ""); } static bool diff --git a/kitty/notifications.py b/kitty/notifications.py index 024bd56d0..3c8be6adb 100644 --- a/kitty/notifications.py +++ b/kitty/notifications.py @@ -640,8 +640,10 @@ class MacOSIntegration(DesktopIntegration): return if event == 'created': n = self.notification_manager.notification_created(desktop_notification_id) - from .fast_data_types import cocoa_live_delivered_notifications - cocoa_live_delivered_notifications() # so that we purge dead notifications + # so that we purge dead notifications, check for live notifications + # after a few seconds, cant check right away as cocoa does not + # report the created notification as live. + add_timer(self.check_live_delivered_notifications, 5.0, False) if n and n.sound_name in standard_sound_names: from .fast_data_types import cocoa_play_system_sound_by_id_async cocoa_play_system_sound_by_id_async(standard_sound_names[n.sound_name][1]) @@ -666,6 +668,10 @@ class MacOSIntegration(DesktopIntegration): log_error('No category found with buttons:', n.buttons) log_error('Current categories:', self.current_categories) + def check_live_delivered_notifications(self, *a: object) -> None: + from .fast_data_types import cocoa_live_delivered_notifications + cocoa_live_delivered_notifications() + class FreeDesktopIntegration(DesktopIntegration):