diff --git a/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift b/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift index 9665cfee..e15738ee 100755 --- a/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift +++ b/code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift @@ -180,6 +180,9 @@ class MainWindowController: NSWindowController, NSWindowDelegate, WKNavigationDe // makes this app and window impossible(?)/difficult to ignore msc_log("msc", "start_obnoxious_mode") + // make sure we're frontmost + NSApp.activate(ignoringOtherApps: true) + // make it very difficult to switch away from this app NSApp.presentationOptions = NSApp.currentSystemPresentationOptions.union( NSApplication.PresentationOptions([.hideDock, .disableHideApplication, .disableProcessSwitching, .disableForceQuit])) diff --git a/code/apps/munki-notifier/munki-notifier/AppDelegate.m b/code/apps/munki-notifier/munki-notifier/AppDelegate.m index ea428dc2..0c1864b9 100644 --- a/code/apps/munki-notifier/munki-notifier/AppDelegate.m +++ b/code/apps/munki-notifier/munki-notifier/AppDelegate.m @@ -12,6 +12,7 @@ #import NSString * const NotificationCenterUIBundleID = @"com.apple.notificationcenterui"; +NSString * const MunkiAppURL = @"munki://"; NSString * const MunkiNotificationURL = @"munki://notify"; long const DefaultUseNotificationCenterDays = 3; @@ -113,6 +114,10 @@ long const DefaultUseNotificationCenterDays = 3; // to launch MSC.app [[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications]; } + // work around a bug with multiple spaces by opening the + // app first, sleeping, then telling the app to notify + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: MunkiAppURL]]; + sleep(1); [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: MunkiNotificationURL]]; [NSApp terminate: self]; return; @@ -147,16 +152,11 @@ long const DefaultUseNotificationCenterDays = 3; message = deadlineMessage; } - // Create options (userInfo) dictionary - NSMutableDictionary *options = [NSMutableDictionary dictionary]; - options[@"action"] = @"open_url"; - options[@"value"] = MunkiNotificationURL; - // deliver the notification [self deliverNotificationWithTitle:title subtitle:subtitle message:message - options:options + options:nil sound:nil]; } @@ -256,8 +256,14 @@ long const DefaultUseNotificationCenterDays = 3; NSLog(@" value: %@", value); if ([action isEqualToString:@"open_url"]){ + // this option currently unused [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:value]]; } else { + // tell MSC app to notify user of updates + // work around a bug with multiple spaces by opening the + // app first, sleeping, then telling the app to notify + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: MunkiAppURL]]; + sleep(1); [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: MunkiNotificationURL]]; } diff --git a/code/apps/munki-notifier/munki-notifier/Info.plist b/code/apps/munki-notifier/munki-notifier/Info.plist index 0ce7f78e..c2bd3749 100644 --- a/code/apps/munki-notifier/munki-notifier/Info.plist +++ b/code/apps/munki-notifier/munki-notifier/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0 + 2.1.0 CFBundleSignature ???? CFBundleVersion