diff options
Diffstat (limited to 'sbdidlaunch.mm')
-rw-r--r-- | sbdidlaunch.mm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sbdidlaunch.mm b/sbdidlaunch.mm new file mode 100644 index 0000000..91dbcfe --- /dev/null +++ b/sbdidlaunch.mm @@ -0,0 +1,29 @@ +#import <CoreFoundation/CoreFoundation.h> + +extern "C" void *SBSSpringBoardServerPort(); + +void OnDidLaunch( + CFNotificationCenterRef center, + void *observer, + CFStringRef name, + const void *object, + CFDictionaryRef info +) { + CFRunLoopStop(CFRunLoopGetCurrent()); +} + +int main() { + CFNotificationCenterAddObserver( + CFNotificationCenterGetDarwinNotifyCenter(), + NULL, + &OnDidLaunch, + CFSTR("SBSpringBoardDidLaunchNotification"), + NULL, + NULL + ); + + if (SBSSpringBoardServerPort() == NULL) + CFRunLoopRun(); + + return 0; +} |