aboutsummaryrefslogtreecommitdiffstats
path: root/main.m
diff options
context:
space:
mode:
Diffstat (limited to 'main.m')
-rw-r--r--main.m30
1 files changed, 28 insertions, 2 deletions
diff --git a/main.m b/main.m
index 9ea3d37..8ffc3b2 100644
--- a/main.m
+++ b/main.m
@@ -1,8 +1,28 @@
+#import <Carbon/Carbon.h>
#import <CoreGraphics/CoreGraphics.h>
+#import "Invert.h"
+#import "DDHotKeyCenter.h"
+
#define MAX_DISPLAYS 8
int main(int argc, const char * argv[]) {
+ [NSApplication sharedApplication];
+
+ Invert *invert = [[Invert alloc] init];
+
+ DDHotKeyCenter *c = [DDHotKeyCenter sharedHotKeyCenter];
+ if (
+ ![c registerHotKeyWithKeyCode:kVK_ANSI_8
+ modifierFlags:
+ (NSEventModifierFlagControl | NSEventModifierFlagOption | NSEventModifierFlagCommand)
+ target:invert
+ action:@selector(toggleInvertColors:)
+ object:nil]
+ ) {
+ NSLog(@"Error registering hotkey");
+ }
+
const CGGammaValue inverted_gamma[2] = {1, 0};
CGDirectDisplayID active_displays[MAX_DISPLAYS];
@@ -30,9 +50,15 @@ int main(int argc, const char * argv[]) {
}
}
- sleep(4);
+ // for (;;) {}
+ // sleep(4);
+ //
+ // CGDisplayRestoreColorSyncSettings();
+
+ // TODO: trap?
+ // [invert release];
- CGDisplayRestoreColorSyncSettings();
+ [NSApp run];
return 0;
}