From 5a5e264ca31f3bf5ad20c74e4e933626f78b78b9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 17 May 2024 08:09:19 +0530 Subject: [PATCH] Fix building on older macOS SDK --- kitty/cocoa_window.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kitty/cocoa_window.m b/kitty/cocoa_window.m index 9fa67cfbc..d28e42555 100644 --- a/kitty/cocoa_window.m +++ b/kitty/cocoa_window.m @@ -9,6 +9,7 @@ #include "state.h" #include "cleanup.h" #include "monotonic.h" +#include #include #include #ifndef KITTY_USE_DEPRECATED_MACOS_NOTIFICATION_API @@ -464,6 +465,7 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center if (body) content.body = @(body); if (subtitle) content.subtitle = @(subtitle); content.sound = [UNNotificationSound defaultSound]; +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000 switch (urgency) { case 0: content.interruptionLevel = UNNotificationInterruptionLevelPassive; @@ -472,6 +474,13 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center default: content.interruptionLevel = UNNotificationInterruptionLevelActive; } +#else + if ([content respondsToSelector:@selector(interruptionLevel)]) { + NSUInteger level = 1; + if (urgency == 0) level = 0; else if (urgency == 2) level = 3; + [content setValue:@(level) forKey:@"interruptionLevel"]; + } +#endif // Deliver the notification static unsigned long counter = 1; UNNotificationRequest* request = [