diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4de200 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +.Trashes +*.swp +*~.nib +xcuserdata diff --git a/Clock Bar App/AppDelegate.h b/Clock Bar App/AppDelegate.h new file mode 100644 index 0000000..565fa9e --- /dev/null +++ b/Clock Bar App/AppDelegate.h @@ -0,0 +1,20 @@ +#import + +@interface AppDelegate : NSObject + +@property (weak) IBOutlet NSMenu *statusMenu; +@property (strong, nonatomic) NSStatusItem *statusBar; + +- (IBAction)prefsMenuItemAction:(id)sender; + +- (IBAction)quitMenuItemAction:(id)sender; + +@property (weak) IBOutlet NSMenuItem *muteMenuItem; + +- (void) hideMenuBar:(BOOL)enableState; +- (void) changeColor:(id)sender; +- (NSColor*)colorWithHexColorString:(NSString*)inColorString; + + +@end + diff --git a/Clock Bar App/AppDelegate.m b/Clock Bar App/AppDelegate.m new file mode 100644 index 0000000..2910a5a --- /dev/null +++ b/Clock Bar App/AppDelegate.m @@ -0,0 +1,239 @@ +#import "AppDelegate.h" +#import "TouchBar.h" +#import +#import "TouchButton.h" +#import "TouchDelegate.h" +#import + +static const NSTouchBarItemIdentifier muteIdentifier = @"ns.clock"; +static NSString *const MASCustomShortcutKey = @"customShortcut"; + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +NSButton *touchBarButton; + +@synthesize statusBar; + +TouchButton *button; + +NSString *STATUS_ICON_BLACK = @"clock-64"; + +NSDateFormatter *timeformatter; +NSString *format = @"hh:mm"; +NSMutableAttributedString *colorTitle; + + +- (void) awakeFromNib { + + BOOL hideStatusBar = NO; + BOOL statusBarButtonToggle = NO; + BOOL useAlternateStatusBarIcons = NO; + + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"hide_status_bar"] != nil) { + hideStatusBar = [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_status_bar"]; + } + + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"status_bar_button_toggle"] != nil) { + statusBarButtonToggle = [[NSUserDefaults standardUserDefaults] boolForKey:@"status_bar_button_toggle"]; + } + + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"status_bar_alternate_icons"] != nil) { + useAlternateStatusBarIcons = [[NSUserDefaults standardUserDefaults] boolForKey:@"status_bar_alternate_icons"]; + } + + [[NSUserDefaults standardUserDefaults] setBool:hideStatusBar forKey:@"hide_status_bar"]; + [[NSUserDefaults standardUserDefaults] setBool:statusBarButtonToggle forKey:@"status_bar_button_toggle"]; + [[NSUserDefaults standardUserDefaults] setBool:useAlternateStatusBarIcons forKey:@"status_bar_alternate_icons"]; + + if (!hideStatusBar) { + [self setupStatusBarItem]; + } + +} + +- (void) setupStatusBarItem { + + self.statusBar = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength]; + self.statusBar.menu = self.statusMenu; + + NSImage* statusImage = [self getStatusBarImage]; + + statusImage.size = NSMakeSize(18, 18); + + [statusImage setTemplate:YES]; + + self.statusBar.image = statusImage; + self.statusBar.highlightMode = YES; + self.statusBar.enabled = YES; +} + + +- (void) hideMenuBar: (BOOL) enableState { + + if (!enableState) { + [self setupStatusBarItem]; + } else { + self.statusBar = nil; + } +} + + +-(void)changeColor:(id)sender +{ + + [colorTitle addAttribute:NSForegroundColorAttributeName value:sender range:NSMakeRange(0, button.title.length)]; + [button setAttributedTitle:colorTitle]; +} + +-(void)UpdateTime:(id)sender +{ + NSString *time = [timeformatter stringFromDate:[NSDate date]]; + [colorTitle.mutableString setString:time]; + [button setAttributedTitle:colorTitle]; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + [[[[NSApplication sharedApplication] windows] lastObject] close]; + + DFRSystemModalShowsCloseBoxWhenFrontMost(YES); + + timeformatter = [[NSDateFormatter alloc] init]; + [timeformatter setTimeStyle: NSDateFormatterShortStyle]; + [timeformatter setDateFormat:format]; + + NSDate *now = [NSDate date]; + NSString *newDateString = [timeformatter stringFromDate:now]; + + + button = [TouchButton buttonWithTitle:newDateString target:nil action:nil]; + [button setDelegate: self]; + + NSFont *systemFont = [NSFont systemFontOfSize:14.0f]; + NSDictionary * fontAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:systemFont, NSFontAttributeName, nil]; + + colorTitle = [[NSMutableAttributedString alloc] initWithString:[button title] attributes:fontAttributes]; + + NSString *colorString = [[NSUserDefaults standardUserDefaults] objectForKey:@"clock_color"]; + NSColor *color = nil; + if (colorString == nil){ + color = [NSColor whiteColor]; + } else{ + color = [self getColorForString:colorString]; + } + + [colorTitle addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, button.title.length)]; + [button setAttributedTitle:colorTitle]; + + + NSCustomTouchBarItem *time = [[NSCustomTouchBarItem alloc] initWithIdentifier:muteIdentifier]; + time.view = button; + [NSTouchBarItem addSystemTrayItem:time]; + [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(UpdateTime:) userInfo:nil repeats:YES]; + + touchBarButton = button; + + [NSTouchBarItem addSystemTrayItem:time]; + DFRElementSetControlStripPresenceForIdentifier(muteIdentifier, YES); + + [self enableLoginAutostart]; + +} + +-(NSColor*)getColorForString:(id)sender{ + return [self colorWithHexColorString:sender]; +} + + +- (NSImage*) getStatusBarImage { + + return [NSImage imageNamed:STATUS_ICON_BLACK]; +} + + +-(void) enableLoginAutostart { + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"auto_login"] == nil) { + return; + } + + BOOL state = [[NSUserDefaults standardUserDefaults] boolForKey:@"auto_login"]; + if(!SMLoginItemSetEnabled((__bridge CFStringRef)@"Nihalsharma.Clock-Launcher", !state)) { + NSLog(@"The login was not succesfull"); + } +} + +- (void)applicationWillTerminate:(NSNotification *)aNotification { +} + +-(double) changeState { + return 0; +} + +-(double) changeStateFixed { + return 0; +} + +-(NSColor *)colorState:(double)volume { + + if(!volume) { + return NSColor.redColor; + } else { + return NSColor.clearColor; + } +} + +- (void)onPressed:(TouchButton*)sender +{ + NSLog(@"On Press clicked"); + if ([format isEqual:@"hh:mm"]){ + format = @"HH:mm"; + } else { + format = @"hh:mm"; + } + [timeformatter setDateFormat:format]; +} + +- (void)onLongPressed:(TouchButton*)sender +{ + [[[[NSApplication sharedApplication] windows] lastObject] makeKeyAndOrderFront:nil]; + [[NSApplication sharedApplication] activateIgnoringOtherApps:true]; +} + +- (IBAction)prefsMenuItemAction:(id)sender { + + [self onLongPressed:sender]; +} + +- (IBAction)quitMenuItemAction:(id)sender { + [NSApp terminate:nil]; +} + +- (NSColor*)colorWithHexColorString:(NSString*)inColorString +{ + NSColor* result = nil; + unsigned colorCode = 0; + unsigned char redByte, greenByte, blueByte; + + if (nil != inColorString) + { + NSScanner* scanner = [NSScanner scannerWithString:inColorString]; + (void) [scanner scanHexInt:&colorCode]; // ignore error + } + redByte = (unsigned char)(colorCode >> 16); + greenByte = (unsigned char)(colorCode >> 8); + blueByte = (unsigned char)(colorCode); // masks off high bits + + result = [NSColor + colorWithCalibratedRed:(CGFloat)redByte / 0xff + green:(CGFloat)greenByte / 0xff + blue:(CGFloat)blueByte / 0xff + alpha:1.0]; + return result; +} + + + +@end diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/Contents.json b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..893ff63 --- /dev/null +++ b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "clock-16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "clock-32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "clock-33.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "clock-64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "clock-128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "clock-257.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "clock-256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "clock-514.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "clock-512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "clock-513.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-128.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-128.png new file mode 100644 index 0000000..d65bbd1 Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-128.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-16.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-16.png new file mode 100644 index 0000000..e7383b2 Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-16.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-256.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-256.png new file mode 100644 index 0000000..39b06f3 Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-256.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-257.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-257.png new file mode 100644 index 0000000..39b06f3 Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-257.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-32.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-32.png new file mode 100644 index 0000000..e3ba56e Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-32.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-33.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-33.png new file mode 100644 index 0000000..e3ba56e Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-33.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-512.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-512.png new file mode 100644 index 0000000..38255fa Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-512.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-513.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-513.png new file mode 100644 index 0000000..38255fa Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-513.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-514.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-514.png new file mode 100644 index 0000000..38255fa Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-514.png differ diff --git a/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-64.png b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-64.png new file mode 100644 index 0000000..0584faf Binary files /dev/null and b/Clock Bar App/Assets.xcassets/AppIcon.appiconset/clock-64.png differ diff --git a/Clock Bar App/Assets.xcassets/Contents.json b/Clock Bar App/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Clock Bar App/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Clock Bar App/Assets.xcassets/logo.imageset/Contents.json b/Clock Bar App/Assets.xcassets/logo.imageset/Contents.json new file mode 100644 index 0000000..9aece15 --- /dev/null +++ b/Clock Bar App/Assets.xcassets/logo.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "clock-64.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "clock-65.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "clock-66.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Clock Bar App/Assets.xcassets/logo.imageset/clock-64.png b/Clock Bar App/Assets.xcassets/logo.imageset/clock-64.png new file mode 100644 index 0000000..0584faf Binary files /dev/null and b/Clock Bar App/Assets.xcassets/logo.imageset/clock-64.png differ diff --git a/Clock Bar App/Assets.xcassets/logo.imageset/clock-65.png b/Clock Bar App/Assets.xcassets/logo.imageset/clock-65.png new file mode 100644 index 0000000..0584faf Binary files /dev/null and b/Clock Bar App/Assets.xcassets/logo.imageset/clock-65.png differ diff --git a/Clock Bar App/Assets.xcassets/logo.imageset/clock-66.png b/Clock Bar App/Assets.xcassets/logo.imageset/clock-66.png new file mode 100644 index 0000000..0584faf Binary files /dev/null and b/Clock Bar App/Assets.xcassets/logo.imageset/clock-66.png differ diff --git a/Clock Bar App/Base.lproj/Main.storyboard b/Clock Bar App/Base.lproj/Main.storyboard new file mode 100644 index 0000000..c13a75a --- /dev/null +++ b/Clock Bar App/Base.lproj/Main.storyboard @@ -0,0 +1,878 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clock Bar App/ClickableTextField.h b/Clock Bar App/ClickableTextField.h new file mode 100644 index 0000000..1156a23 --- /dev/null +++ b/Clock Bar App/ClickableTextField.h @@ -0,0 +1,12 @@ +// +// ClickableTextField.h +// Clock Bar +// +// Created by nihalsharma on 11/03/18. +// Copyright © 2018 Nihalsharma. All rights reserved. +// + +#import + +@interface ClickableTextField : NSTextField +@end diff --git a/Clock Bar App/ClickableTextField.m b/Clock Bar App/ClickableTextField.m new file mode 100644 index 0000000..f5577c7 --- /dev/null +++ b/Clock Bar App/ClickableTextField.m @@ -0,0 +1,22 @@ +// +// ClickableTextField.m +// Clock Bar +// +// Created by nihalsharma on 11/03/18. +// Copyright © 2018 Nihalsharma. All rights reserved. +// + +#import "ClickableTextField.h" + +@interface ClickableTextField() + +@end + +@implementation ClickableTextField + +- (void)mouseDown:(NSEvent *)theEvent +{ + [self sendAction:[self action] to:[self target]]; +} + +@end diff --git a/Clock Bar App/Clock Bar App.entitlements b/Clock Bar App/Clock Bar App.entitlements new file mode 100644 index 0000000..0c67376 --- /dev/null +++ b/Clock Bar App/Clock Bar App.entitlements @@ -0,0 +1,5 @@ + + + + + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj/project.pbxproj b/Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d6c5a5a --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj/project.pbxproj @@ -0,0 +1,326 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 11B86E851EDEAC980069D254 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 11B86E831EDEAC980069D254 /* Main.storyboard */; }; + D5A4626C2054B0B300E8B47E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D5A462662054B0B200E8B47E /* Assets.xcassets */; }; + D5A4626D2054B0B300E8B47E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D5A462672054B0B200E8B47E /* AppDelegate.m */; }; + D5A4626E2054B0B300E8B47E /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D5A462692054B0B200E8B47E /* Info.plist */; }; + D5A4626F2054B0B300E8B47E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D5A4626B2054B0B200E8B47E /* ViewController.m */; }; + D5A462712054B0C700E8B47E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D5A462702054B0C700E8B47E /* main.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 11B86E751EDEAC970069D254 /* Clock Launcher.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Clock Launcher.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 11B86E841EDEAC980069D254 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + D5A462662054B0B200E8B47E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = "Clock Launcher/Assets.xcassets"; sourceTree = SOURCE_ROOT; }; + D5A462672054B0B200E8B47E /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = "Clock Launcher/AppDelegate.m"; sourceTree = SOURCE_ROOT; }; + D5A462682054B0B200E8B47E /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = "Clock Launcher/ViewController.h"; sourceTree = SOURCE_ROOT; }; + D5A462692054B0B200E8B47E /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Clock Launcher/Info.plist"; sourceTree = SOURCE_ROOT; }; + D5A4626A2054B0B200E8B47E /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = "Clock Launcher/AppDelegate.h"; sourceTree = SOURCE_ROOT; }; + D5A4626B2054B0B200E8B47E /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = "Clock Launcher/ViewController.m"; sourceTree = SOURCE_ROOT; }; + D5A462702054B0C700E8B47E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = "Clock Launcher/main.m"; sourceTree = SOURCE_ROOT; }; + D5A462722054B0D600E8B47E /* Clock Launcher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = "Clock Launcher.entitlements"; path = "Clock Launcher/Clock Launcher.entitlements"; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 11B86E721EDEAC970069D254 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 11B86E6C1EDEAC970069D254 = { + isa = PBXGroup; + children = ( + 11B86E771EDEAC970069D254 /* Clock Launcher */, + 11B86E761EDEAC970069D254 /* Products */, + ); + sourceTree = ""; + }; + 11B86E761EDEAC970069D254 /* Products */ = { + isa = PBXGroup; + children = ( + 11B86E751EDEAC970069D254 /* Clock Launcher.app */, + ); + name = Products; + sourceTree = ""; + }; + 11B86E771EDEAC970069D254 /* Clock Launcher */ = { + isa = PBXGroup; + children = ( + D5A462722054B0D600E8B47E /* Clock Launcher.entitlements */, + D5A4626A2054B0B200E8B47E /* AppDelegate.h */, + D5A462672054B0B200E8B47E /* AppDelegate.m */, + D5A462662054B0B200E8B47E /* Assets.xcassets */, + D5A462692054B0B200E8B47E /* Info.plist */, + D5A462682054B0B200E8B47E /* ViewController.h */, + D5A4626B2054B0B200E8B47E /* ViewController.m */, + 11B86E831EDEAC980069D254 /* Main.storyboard */, + 11B86E7B1EDEAC970069D254 /* Supporting Files */, + ); + path = "Clock Launcher"; + sourceTree = ""; + }; + 11B86E7B1EDEAC970069D254 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + D5A462702054B0C700E8B47E /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 11B86E741EDEAC970069D254 /* Clock Launcher */ = { + isa = PBXNativeTarget; + buildConfigurationList = 11B86E891EDEAC980069D254 /* Build configuration list for PBXNativeTarget "Clock Launcher" */; + buildPhases = ( + 11B86E711EDEAC970069D254 /* Sources */, + 11B86E721EDEAC970069D254 /* Frameworks */, + 11B86E731EDEAC970069D254 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Clock Launcher"; + productName = "Mute Me Now Launcher"; + productReference = 11B86E751EDEAC970069D254 /* Clock Launcher.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 11B86E6D1EDEAC970069D254 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = Nihalsharma; + TargetAttributes = { + 11B86E741EDEAC970069D254 = { + CreatedOnToolsVersion = 8.3.1; + DevelopmentTeam = 3K68XHVR7W; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + }; + }; + buildConfigurationList = 11B86E701EDEAC970069D254 /* Build configuration list for PBXProject "Clock Launcher" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 11B86E6C1EDEAC970069D254; + productRefGroup = 11B86E761EDEAC970069D254 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 11B86E741EDEAC970069D254 /* Clock Launcher */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 11B86E731EDEAC970069D254 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D5A4626E2054B0B300E8B47E /* Info.plist in Resources */, + D5A4626C2054B0B300E8B47E /* Assets.xcassets in Resources */, + 11B86E851EDEAC980069D254 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 11B86E711EDEAC970069D254 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D5A4626D2054B0B300E8B47E /* AppDelegate.m in Sources */, + D5A462712054B0C700E8B47E /* main.m in Sources */, + D5A4626F2054B0B300E8B47E /* ViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 11B86E831EDEAC980069D254 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 11B86E841EDEAC980069D254 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 11B86E871EDEAC980069D254 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 11B86E881EDEAC980069D254 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 11B86E8A1EDEAC980069D254 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Clock Launcher/Clock Launcher.entitlements"; + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 3K68XHVR7W; + INFOPLIST_FILE = "Clock Launcher/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Nihalsharma.Clock-Launcher"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 11B86E8B1EDEAC980069D254 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Clock Launcher/Clock Launcher.entitlements"; + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 3K68XHVR7W; + INFOPLIST_FILE = "Clock Launcher/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "Nihalsharma.Clock-Launcher"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 11B86E701EDEAC970069D254 /* Build configuration list for PBXProject "Clock Launcher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11B86E871EDEAC980069D254 /* Debug */, + 11B86E881EDEAC980069D254 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 11B86E891EDEAC980069D254 /* Build configuration list for PBXNativeTarget "Clock Launcher" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11B86E8A1EDEAC980069D254 /* Debug */, + 11B86E8B1EDEAC980069D254 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 11B86E6D1EDEAC970069D254 /* Project object */; +} diff --git a/Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/AppDelegate.h b/Clock Bar App/Clock Launcher/Clock Launcher/AppDelegate.h new file mode 100644 index 0000000..f6c4eaf --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/AppDelegate.h @@ -0,0 +1,7 @@ +// +#import + +@interface AppDelegate : NSObject + +@end + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/AppDelegate.m b/Clock Bar App/Clock Launcher/Clock Launcher/AppDelegate.m new file mode 100644 index 0000000..b892ee9 --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/AppDelegate.m @@ -0,0 +1,32 @@ +#import "AppDelegate.h" + + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + NSString *path = [[[[[[NSBundle mainBundle] bundlePath] + stringByDeletingLastPathComponent] + stringByDeletingLastPathComponent] + stringByDeletingLastPathComponent] + stringByDeletingLastPathComponent]; + [[NSWorkspace sharedWorkspace] launchApplication:path]; + [NSApp terminate:nil]; +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + +- (IBAction)prefsMenuItemAction:(id)sender { +} +- (IBAction)menuMenuItemAction:(id)sender { +} +@end diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/Assets.xcassets/AppIcon.appiconset/Contents.json b/Clock Bar App/Clock Launcher/Clock Launcher/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/Base.lproj/Main.storyboard b/Clock Bar App/Clock Launcher/Clock Launcher/Base.lproj/Main.storyboard new file mode 100644 index 0000000..66829af --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/Base.lproj/Main.storyboard @@ -0,0 +1,656 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/Clock Launcher.entitlements b/Clock Bar App/Clock Launcher/Clock Launcher/Clock Launcher.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/Clock Launcher.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/Info.plist b/Clock Bar App/Clock Launcher/Clock Launcher/Info.plist new file mode 100644 index 0000000..14128d9 --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.utilities + LSBackgroundOnly + + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + LSUIElement + + NSHumanReadableCopyright + Copyright © 2018 Nihalsharma. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/ViewController.h b/Clock Bar App/Clock Launcher/Clock Launcher/ViewController.h new file mode 100644 index 0000000..91281dd --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/ViewController.h @@ -0,0 +1,7 @@ +#import + +@interface ViewController : NSViewController + + +@end + diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/ViewController.m b/Clock Bar App/Clock Launcher/Clock Launcher/ViewController.m new file mode 100644 index 0000000..96af35d --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/ViewController.m @@ -0,0 +1,22 @@ +#import "ViewController.h" + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; +} + +- (IBAction)showMenuBarChanged:(id)sender { +} + +- (IBAction)statusBarToggleChanged:(id)sender { +} + + + +@end diff --git a/Clock Bar App/Clock Launcher/Clock Launcher/main.m b/Clock Bar App/Clock Launcher/Clock Launcher/main.m new file mode 100644 index 0000000..ee09a55 --- /dev/null +++ b/Clock Bar App/Clock Launcher/Clock Launcher/main.m @@ -0,0 +1,12 @@ +// +// main.m +// +// Created by nihalsharma on 09/03/18. +// Copyright © 2018 nihalsharma. All rights reserved. +// + +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +} diff --git a/Clock Bar App/Info.plist b/Clock Bar App/Info.plist new file mode 100644 index 0000000..e4a72a6 --- /dev/null +++ b/Clock Bar App/Info.plist @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.01 + CFBundleVersion + 2 + LSApplicationCategoryType + public.app-category.utilities + LSBackgroundOnly + + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + LSUIElement + + NSHumanReadableCopyright + Copyright © 2018 Nihalsharma. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Clock Bar App/TouchBar.h b/Clock Bar App/TouchBar.h new file mode 100644 index 0000000..327e4d0 --- /dev/null +++ b/Clock Bar App/TouchBar.h @@ -0,0 +1,16 @@ +#import + +extern void DFRElementSetControlStripPresenceForIdentifier(NSString *, BOOL); +extern void DFRSystemModalShowsCloseBoxWhenFrontMost(BOOL); + +@interface NSTouchBarItem () + ++ (void)addSystemTrayItem:(NSTouchBarItem *)item; + +@end + +@interface NSTouchBar () + ++ (void)presentSystemModalFunctionBar:(NSTouchBar *)touchBar systemTrayItemIdentifier:(NSString *)identifier; + +@end diff --git a/Clock Bar App/TouchButton.h b/Clock Bar App/TouchButton.h new file mode 100644 index 0000000..fb39299 --- /dev/null +++ b/Clock Bar App/TouchButton.h @@ -0,0 +1,8 @@ +#import +#import "TouchDelegate.h" + +@interface TouchButton : NSButton + +@property (nonatomic, weak) id delegate; + +@end diff --git a/Clock Bar App/TouchButton.m b/Clock Bar App/TouchButton.m new file mode 100644 index 0000000..5d22691 --- /dev/null +++ b/Clock Bar App/TouchButton.m @@ -0,0 +1,90 @@ +#import +#import "TouchButton.h" + +static double LONG_PRESS_TIME = 0.5; + +@interface TouchButton () + +@property double touchBeganTime; + +@end + + +@implementation TouchButton + +- (BOOL)acceptsFirstResponder +{ + return YES; +} + +- (void)touchesBeganWithEvent:(NSEvent *)event +{ + + NSSet *touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:self]; + + NSTouch *touch = touches.anyObject; + if (touch != nil) + { + if (touch.type == NSTouchTypeDirect) + { + self.touchBeganTime = [[NSDate date] timeIntervalSince1970]; + } + } + + [super touchesBeganWithEvent:event]; +} + +- (void)touchesMovedWithEvent:(NSEvent *)event +{ + + for (NSTouch *touch in [event touchesMatchingPhase:NSTouchPhaseMoved inView:self]) + { + if (touch.type == NSTouchTypeDirect) + { + break; + } + } + + [super touchesMovedWithEvent:event]; +} + +- (void)touchesEndedWithEvent:(NSEvent *)event +{ + + for (NSTouch *touch in [event touchesMatchingPhase:NSTouchPhaseEnded inView:self]) + { + if (touch.type == NSTouchTypeDirect) + { + if(self.delegate != nil) + { + double touchTime = [[NSDate date] timeIntervalSince1970] - self.touchBeganTime; + if(touchTime >= LONG_PRESS_TIME) { + [self.delegate onLongPressed: self]; + } + else + { + [self.delegate onPressed: self]; + } + } + break; + } + } + + [super touchesEndedWithEvent:event]; +} + +- (void)touchesCancelledWithEvent:(NSEvent *)event +{ + + for (NSTouch *touch in [event touchesMatchingPhase:NSTouchPhaseMoved inView:self]) + { + if (touch.type == NSTouchTypeDirect) + { + break; + } + } + + [super touchesCancelledWithEvent:event]; +} + +@end diff --git a/Clock Bar App/TouchDelegate.h b/Clock Bar App/TouchDelegate.h new file mode 100644 index 0000000..51edede --- /dev/null +++ b/Clock Bar App/TouchDelegate.h @@ -0,0 +1,9 @@ +#import + +@protocol TouchDelegate + +- (void)onPressed:(NSButton *)sender; + +- (void)onLongPressed:(NSButton *)sender; + +@end diff --git a/Clock Bar App/ViewController.h b/Clock Bar App/ViewController.h new file mode 100644 index 0000000..d303168 --- /dev/null +++ b/Clock Bar App/ViewController.h @@ -0,0 +1,21 @@ +#import + +@interface ViewController : NSViewController + +@property (weak) IBOutlet NSButton *autoLoginState; +@property (weak) IBOutlet NSButton *showInMenuBarState; + + + +- (IBAction)showMenuBarChanged:(id)sender; + +- (IBAction)whiteButtonClicked:(id)sender; +- (IBAction)redButtonClicked:(id)sender; +- (IBAction)yellowButtonClicked:(id)sender; +- (IBAction)blueButtonClicked:(id)sender; +- (IBAction)greenButtonClicked:(id)sender; +- (IBAction)pinkButtonClicked:(id)sender; + + +@end + diff --git a/Clock Bar App/ViewController.m b/Clock Bar App/ViewController.m new file mode 100644 index 0000000..9e9b320 --- /dev/null +++ b/Clock Bar App/ViewController.m @@ -0,0 +1,138 @@ +#import "ViewController.h" +#import "AppDelegate.h" +#include + + +static NSString *const MASCustomShortcutKey = @"customShortcut"; + +static void *MASObservingContext = &MASObservingContext; + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + if ([[NSUserDefaults standardUserDefaults] objectForKey:@"auto_login"] == nil) { + + [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"auto_login"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + } + + BOOL state = [[NSUserDefaults standardUserDefaults] boolForKey:@"auto_login"]; + [self.autoLoginState setState: !state]; + + BOOL hideStatusBarState = [[NSUserDefaults standardUserDefaults] boolForKey:@"hide_status_bar"]; + [self.showInMenuBarState setState: hideStatusBarState]; + + NSLog(@"View Load"); +} + +-(void)viewDidAppear { + [super viewDidAppear]; + [[self.view window] setTitle:@"Clock Bar"]; + [[self.view window] center]; + +} + + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + [[[[NSApplication sharedApplication] windows] lastObject] setTitle:@"Clock Bar"]; +} + +- (IBAction)quitPressed:(id)sender { + [NSApp terminate:nil]; //TODO or quit about window +} + +- (IBAction)onLoginStartChanged:(id)sender { + NSLog(@"Login start changed"); + NSInteger state = [self.autoLoginState state]; + BOOL enableState = NO; + if(state == NSOnState) { + enableState = YES; + } + if(SMLoginItemSetEnabled((__bridge CFStringRef)@"Nihalsharma.Clock-Launcher", enableState)) { + [[NSUserDefaults standardUserDefaults] setBool:!enableState forKey:@"auto_login"]; + } +} + +- (IBAction)showMenuBarChanged:(id)sender { + + NSInteger state = [self.showInMenuBarState state]; + + BOOL enableState = NO; + if(state == NSOnState) { + enableState = YES; + } + + [[NSUserDefaults standardUserDefaults] setBool:enableState forKey:@"hide_status_bar"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + [appDelegate hideMenuBar:enableState]; + + + if (enableState == YES) { + + NSString *msgText = @"Long press on the Touch Bar Clock Button to show Preferences when the Menu Item is disabled."; + + NSAlert* msgBox = [[NSAlert alloc] init] ; + [msgBox setMessageText:msgText]; + [msgBox addButtonWithTitle: @"OK"]; + [msgBox runModal]; + } + +} + + +- (IBAction)whiteButtonClicked:(id)sender { + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + NSColor *color = [appDelegate colorWithHexColorString:@"FFFFFF"]; + [[NSUserDefaults standardUserDefaults] setObject:@"FFFFFF" forKey:@"clock_color"]; + [appDelegate changeColor:color]; +} + +- (IBAction)greenButtonClicked:(id)sender { + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + NSColor *color = [appDelegate colorWithHexColorString:@"00FF00"]; + [[NSUserDefaults standardUserDefaults] setObject:@"00FF00" forKey:@"clock_color"]; + [appDelegate changeColor:color]; +} + +- (IBAction)pinkButtonClicked:(id)sender { + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + NSColor *color = [appDelegate colorWithHexColorString:@"FE69F3"]; + [[NSUserDefaults standardUserDefaults] setObject:@"FE69F3" forKey:@"clock_color"]; + [appDelegate changeColor:color]; +} + +- (IBAction)redButtonClicked:(id)sender { + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + NSColor *color = [appDelegate colorWithHexColorString:@"FF0000"]; + [[NSUserDefaults standardUserDefaults] setObject:@"FF00000" forKey:@"clock_color"]; + [appDelegate changeColor:color]; +} + +- (IBAction)yellowButtonClicked:(id)sender { + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + NSColor *color = [appDelegate colorWithHexColorString:@"FFFF00"]; + [[NSUserDefaults standardUserDefaults] setObject:@"FFFF00" forKey:@"clock_color"]; + + + [appDelegate changeColor:color]; +} + +- (IBAction)blueButtonClicked:(id)sender { + AppDelegate *appDelegate = (AppDelegate *) [[NSApplication sharedApplication] delegate]; + NSColor *color = [appDelegate colorWithHexColorString:@"30E6FF"]; + [[NSUserDefaults standardUserDefaults] setObject:@"30E6FF" forKey:@"clock_color"]; + + + [appDelegate changeColor:color]; +} + + + + +@end diff --git a/Clock Bar App/clock-64.png b/Clock Bar App/clock-64.png new file mode 100644 index 0000000..0584faf Binary files /dev/null and b/Clock Bar App/clock-64.png differ diff --git a/Clock Bar App/main.m b/Clock Bar App/main.m new file mode 100644 index 0000000..8a6799b --- /dev/null +++ b/Clock Bar App/main.m @@ -0,0 +1,5 @@ +#import + +int main(int argc, const char * argv[]) { + return NSApplicationMain(argc, argv); +} diff --git a/Clock Bar.entitlements b/Clock Bar.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/Clock Bar.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/Clock Bar.xcodeproj/project.pbxproj b/Clock Bar.xcodeproj/project.pbxproj new file mode 100644 index 0000000..cca0d9f --- /dev/null +++ b/Clock Bar.xcodeproj/project.pbxproj @@ -0,0 +1,452 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1141FDF21EEFF6DD00CA5B30 /* TouchButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 1141FDF11EEFF6DD00CA5B30 /* TouchButton.m */; }; + 11B86E521EDE9B4D0069D254 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 11B86E511EDE9B4D0069D254 /* AppDelegate.m */; }; + 11B86E551EDE9B4D0069D254 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 11B86E541EDE9B4D0069D254 /* main.m */; }; + 11B86E581EDE9B4D0069D254 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 11B86E571EDE9B4D0069D254 /* ViewController.m */; }; + 11B86E5A1EDE9B4D0069D254 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 11B86E591EDE9B4D0069D254 /* Assets.xcassets */; }; + 11B86E5D1EDE9B4D0069D254 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 11B86E5B1EDE9B4D0069D254 /* Main.storyboard */; }; + 11B86E661EDE9BD00069D254 /* DFRFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11B86E651EDE9BD00069D254 /* DFRFoundation.framework */; }; + 11B86E981EDEC6720069D254 /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11B86E921EDEAD1D0069D254 /* ServiceManagement.framework */; }; + D53AAC71205497DB00767C9A /* ClickableTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = D53AAC70205497DB00767C9A /* ClickableTextField.m */; }; + D53E002C2054A19A001625A6 /* clock-64.png in Resources */ = {isa = PBXBuildFile; fileRef = D53E002B2054A19A001625A6 /* clock-64.png */; }; + D53E002E2054A1AB001625A6 /* clock-64.png in Resources */ = {isa = PBXBuildFile; fileRef = D53E002D2054A1AA001625A6 /* clock-64.png */; }; + D53E00302054A1B1001625A6 /* clock-64.png in Resources */ = {isa = PBXBuildFile; fileRef = D53E002F2054A1B1001625A6 /* clock-64.png */; }; + D5A462752054B17B00E8B47E /* Clock Launcher.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = D5A462652054B06B00E8B47E /* Clock Launcher.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + D5A462642054B06B00E8B47E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D5A462602054B06B00E8B47E /* Clock Launcher.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 11B86E751EDEAC970069D254; + remoteInfo = "Clock Launcher"; + }; + D5A462732054B17500E8B47E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D5A462602054B06B00E8B47E /* Clock Launcher.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 11B86E741EDEAC970069D254; + remoteInfo = "Clock Launcher"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 11B86E941EDEAD980069D254 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = Contents/Library/LoginItems; + dstSubfolderSpec = 1; + files = ( + D5A462752054B17B00E8B47E /* Clock Launcher.app in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1141FDF01EEFF6DD00CA5B30 /* TouchButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchButton.h; sourceTree = ""; }; + 1141FDF11EEFF6DD00CA5B30 /* TouchButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TouchButton.m; sourceTree = ""; }; + 1141FDF51EEFFA0000CA5B30 /* TouchDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchDelegate.h; sourceTree = ""; }; + 11B86E4D1EDE9B4D0069D254 /* Clock Bar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Clock Bar.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 11B86E501EDE9B4D0069D254 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 11B86E511EDE9B4D0069D254 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 11B86E541EDE9B4D0069D254 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 11B86E561EDE9B4D0069D254 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 11B86E571EDE9B4D0069D254 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 11B86E591EDE9B4D0069D254 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 11B86E5C1EDE9B4D0069D254 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 11B86E5E1EDE9B4D0069D254 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 11B86E651EDE9BD00069D254 /* DFRFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = DFRFoundation.framework; path = ../../../../../../System/Library/PrivateFrameworks/DFRFoundation.framework; sourceTree = ""; }; + 11B86E671EDE9CDC0069D254 /* TouchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchBar.h; sourceTree = ""; }; + 11B86E921EDEAD1D0069D254 /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; }; + 11B86E9A1EDECB3F0069D254 /* Clock Bar App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Clock Bar App.entitlements"; sourceTree = ""; }; + D53AAC6F205497C200767C9A /* ClickableTextField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClickableTextField.h; sourceTree = ""; }; + D53AAC70205497DB00767C9A /* ClickableTextField.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ClickableTextField.m; sourceTree = ""; }; + D53C8A03205510EF00EAAA3D /* Clock Bar.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Clock Bar.entitlements"; sourceTree = ""; }; + D53E002B2054A19A001625A6 /* clock-64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-64.png"; sourceTree = ""; }; + D53E002D2054A1AA001625A6 /* clock-64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "clock-64.png"; path = "../../.Trash/clock-64.png"; sourceTree = ""; }; + D53E002F2054A1B1001625A6 /* clock-64.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "clock-64.png"; sourceTree = ""; }; + D5A462602054B06B00E8B47E /* Clock Launcher.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = "Clock Launcher.xcodeproj"; path = "Clock Bar App/Clock Launcher/Clock Launcher.xcodeproj"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 11B86E4A1EDE9B4D0069D254 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 11B86E981EDEC6720069D254 /* ServiceManagement.framework in Frameworks */, + 11B86E661EDE9BD00069D254 /* DFRFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 11B86E441EDE9B4C0069D254 = { + isa = PBXGroup; + children = ( + D53C8A03205510EF00EAAA3D /* Clock Bar.entitlements */, + D5A462602054B06B00E8B47E /* Clock Launcher.xcodeproj */, + D53E002B2054A19A001625A6 /* clock-64.png */, + 5D4763251F0562F2005E8DB0 /* Graphics */, + 11B86E4F1EDE9B4D0069D254 /* Clock Bar App */, + 11B86E4E1EDE9B4D0069D254 /* Products */, + 11B86E641EDE9BD00069D254 /* Frameworks */, + ); + sourceTree = ""; + }; + 11B86E4E1EDE9B4D0069D254 /* Products */ = { + isa = PBXGroup; + children = ( + 11B86E4D1EDE9B4D0069D254 /* Clock Bar.app */, + ); + name = Products; + sourceTree = ""; + }; + 11B86E4F1EDE9B4D0069D254 /* Clock Bar App */ = { + isa = PBXGroup; + children = ( + D53E002F2054A1B1001625A6 /* clock-64.png */, + 11B86E9A1EDECB3F0069D254 /* Clock Bar App.entitlements */, + 11B86E501EDE9B4D0069D254 /* AppDelegate.h */, + 11B86E511EDE9B4D0069D254 /* AppDelegate.m */, + 11B86E561EDE9B4D0069D254 /* ViewController.h */, + 11B86E571EDE9B4D0069D254 /* ViewController.m */, + 11B86E591EDE9B4D0069D254 /* Assets.xcassets */, + 11B86E5B1EDE9B4D0069D254 /* Main.storyboard */, + 11B86E5E1EDE9B4D0069D254 /* Info.plist */, + 11B86E531EDE9B4D0069D254 /* Supporting Files */, + 11B86E671EDE9CDC0069D254 /* TouchBar.h */, + 1141FDF01EEFF6DD00CA5B30 /* TouchButton.h */, + 1141FDF11EEFF6DD00CA5B30 /* TouchButton.m */, + 1141FDF51EEFFA0000CA5B30 /* TouchDelegate.h */, + D53AAC6F205497C200767C9A /* ClickableTextField.h */, + D53AAC70205497DB00767C9A /* ClickableTextField.m */, + ); + path = "Clock Bar App"; + sourceTree = ""; + }; + 11B86E531EDE9B4D0069D254 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 11B86E541EDE9B4D0069D254 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 11B86E641EDE9BD00069D254 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 11B86E921EDEAD1D0069D254 /* ServiceManagement.framework */, + 11B86E651EDE9BD00069D254 /* DFRFoundation.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 5D4763251F0562F2005E8DB0 /* Graphics */ = { + isa = PBXGroup; + children = ( + D53E002D2054A1AA001625A6 /* clock-64.png */, + ); + name = Graphics; + sourceTree = ""; + }; + D5A462612054B06B00E8B47E /* Products */ = { + isa = PBXGroup; + children = ( + D5A462652054B06B00E8B47E /* Clock Launcher.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 11B86E4C1EDE9B4D0069D254 /* Clock Bar */ = { + isa = PBXNativeTarget; + buildConfigurationList = 11B86E611EDE9B4D0069D254 /* Build configuration list for PBXNativeTarget "Clock Bar" */; + buildPhases = ( + 11B86E491EDE9B4D0069D254 /* Sources */, + 11B86E4A1EDE9B4D0069D254 /* Frameworks */, + 11B86E4B1EDE9B4D0069D254 /* Resources */, + 11B86E941EDEAD980069D254 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + D5A462742054B17500E8B47E /* PBXTargetDependency */, + ); + name = "Clock Bar"; + productName = "Mute Me Now"; + productReference = 11B86E4D1EDE9B4D0069D254 /* Clock Bar.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 11B86E451EDE9B4C0069D254 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = Nihalsharma; + TargetAttributes = { + 11B86E4C1EDE9B4D0069D254 = { + CreatedOnToolsVersion = 8.3.1; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + }; + }; + buildConfigurationList = 11B86E481EDE9B4C0069D254 /* Build configuration list for PBXProject "Clock Bar" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 11B86E441EDE9B4C0069D254; + productRefGroup = 11B86E4E1EDE9B4D0069D254 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = D5A462612054B06B00E8B47E /* Products */; + ProjectRef = D5A462602054B06B00E8B47E /* Clock Launcher.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 11B86E4C1EDE9B4D0069D254 /* Clock Bar */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + D5A462652054B06B00E8B47E /* Clock Launcher.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = "Clock Launcher.app"; + remoteRef = D5A462642054B06B00E8B47E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 11B86E4B1EDE9B4D0069D254 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D53E00302054A1B1001625A6 /* clock-64.png in Resources */, + D53E002C2054A19A001625A6 /* clock-64.png in Resources */, + 11B86E5A1EDE9B4D0069D254 /* Assets.xcassets in Resources */, + D53E002E2054A1AB001625A6 /* clock-64.png in Resources */, + 11B86E5D1EDE9B4D0069D254 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 11B86E491EDE9B4D0069D254 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1141FDF21EEFF6DD00CA5B30 /* TouchButton.m in Sources */, + 11B86E581EDE9B4D0069D254 /* ViewController.m in Sources */, + D53AAC71205497DB00767C9A /* ClickableTextField.m in Sources */, + 11B86E551EDE9B4D0069D254 /* main.m in Sources */, + 11B86E521EDE9B4D0069D254 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + D5A462742054B17500E8B47E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Clock Launcher"; + targetProxy = D5A462732054B17500E8B47E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 11B86E5B1EDE9B4D0069D254 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 11B86E5C1EDE9B4D0069D254 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 11B86E5F1EDE9B4D0069D254 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 11B86E601EDE9B4D0069D254 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 11B86E621EDE9B4D0069D254 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Clock Bar.entitlements"; + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 3K68XHVR7W; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", + ); + INFOPLIST_FILE = "Clock Bar App/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "nihalsharma.clock-bar"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + }; + name = Debug; + }; + 11B86E631EDE9B4D0069D254 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = "Clock Bar.entitlements"; + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 3K68XHVR7W; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks", + ); + INFOPLIST_FILE = "Clock Bar App/Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "nihalsharma.clock-bar"; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 11B86E481EDE9B4C0069D254 /* Build configuration list for PBXProject "Clock Bar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11B86E5F1EDE9B4D0069D254 /* Debug */, + 11B86E601EDE9B4D0069D254 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 11B86E611EDE9B4D0069D254 /* Build configuration list for PBXNativeTarget "Clock Bar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11B86E621EDE9B4D0069D254 /* Debug */, + 11B86E631EDE9B4D0069D254 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 11B86E451EDE9B4C0069D254 /* Project object */; +} diff --git a/Clock Bar.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Clock Bar.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..2fddef3 --- /dev/null +++ b/Clock Bar.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Clock Bar.xcworkspace/contents.xcworkspacedata b/Clock Bar.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..6096db9 --- /dev/null +++ b/Clock Bar.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cde8338 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Pixel Point + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6b2ea90 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# Clock Bar +Get clock right on the sweetest spot of the macbook, on the touch bar. + + +### Why +The upper right corner seems the farthest place on the planet to look at. Full of menu items, but an area you really find it incovenient. Touch bar has been so convenient for so many things that you want to have everything right there. Having the clock right on the touch bar save you from visiting the darkest corner and saves so much effort. Seriously!!! You will realise. + +### Options +- use long tap on the Touch Bar icon to open Preferences +- find the Open at Login option in Preferences +- tap on the touch bar to toggle between HH:mm and hh:mm format +- choose from different colors + + +### Ideas for development +If you have any ideas that can help us improve this application, please create a new issue. + +You can find approved ideas for future implementation [here](https://github.com/nihalsharma/clock-bar/projects/1) + +### How to contribute + +- Download Xcode +- Fork this repository +- Open repository via Xcode +- Make changes +- Provide Pull Request + +### Thanks for passing by + + +--- +Made by [Nihal Sharma] + +### Screens + +preference + +clock1 + +clock2 diff --git a/clock-64.png b/clock-64.png new file mode 100644 index 0000000..0584faf Binary files /dev/null and b/clock-64.png differ