aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-10-06 01:03:14 +0200
committerTeddy Wing2018-10-06 01:03:14 +0200
commitb93cf2273da91459627ca0746a560bd9f646285f (patch)
tree50d5f2ad95ac323d24bdfce5ba1ffcd04c877a74
parent1a63470316b36e964fc35aee2768627ca1e404f8 (diff)
downloadDomeKey-b93cf2273da91459627ca0746a560bd9f646285f.tar.bz2
main: Run main NSApp code when the `--daemon` flag is passed
-rw-r--r--DomeKey/main.m23
1 files 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;
}