From b93cf2273da91459627ca0746a560bd9f646285f Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 6 Oct 2018 01:03:14 +0200 Subject: main: Run main NSApp code when the `--daemon` flag is passed --- DomeKey/main.m | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/DomeKey/main.m b/DomeKey/main.m index 06db5aa..4eff03d 100644 --- a/DomeKey/main.m +++ b/DomeKey/main.m @@ -17,20 +17,21 @@ int main(int argc, const char * argv[]) { if (config->args.reload) { [Mappings dispatchReload]; - return 0; // TODO: Return result of `notify_post`, and still log - } - - @autoreleasepool { - [NSApplication sharedApplication]; - AppDelegate *app = [[AppDelegate alloc] init]; - [NSApp setDelegate:app]; + // TODO: Return result of `notify_post`, and still log + } else if (config->args.daemon) { + @autoreleasepool { + [NSApplication sharedApplication]; + AppDelegate *app = [[AppDelegate alloc] init]; + [NSApp setDelegate:app]; - // insert code here... - NSLog(@"Hello, World!"); + // insert code here... + NSLog(@"Hello, World!"); - [Mappings observeReloadNotification]; + [Mappings observeReloadNotification]; - [NSApp run]; + [NSApp run]; + } } + return 0; } -- cgit v1.2.3