macOS: Fix waiting for result from desktop notification not working

This commit is contained in:
Kovid Goyal 2025-02-27 19:38:06 +05:30
parent 188c209b2c
commit c43fe38cf1
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 3 deletions

View file

@ -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]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -438,7 +438,7 @@ ident_in_list_of_notifications(NSString *ident, NSArray<UNNotification*> *list)
void
cocoa_report_live_notifications(const char* ident) {
do_notification_callback(ident, "live", "");
do_notification_callback(ident, "live", ident ? ident : "");
}
static bool

View file

@ -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):