diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7277177 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# Xcode +.DS_Store +*/build/* +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +profile +*.moved-aside +DerivedData +.idea/ +*.hmap +xcuserdata/* + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 +*.xcuserstate +project.xcworkspace/ +xcuserdata/ diff --git a/Grid Clock.xcodeproj/project.pbxproj b/Grid Clock.xcodeproj/project.pbxproj new file mode 100755 index 0000000..f70ce6f --- /dev/null +++ b/Grid Clock.xcodeproj/project.pbxproj @@ -0,0 +1,302 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXBuildFile section */ + 3A40066E18B53113005F43A6 /* ScreenSaver.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A40066D18B53113005F43A6 /* ScreenSaver.framework */; }; + 3A40068318B53129005F43A6 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A40068218B53129005F43A6 /* WebKit.framework */; }; + 3A40068518B53226005F43A6 /* index.html in Resources */ = {isa = PBXBuildFile; fileRef = 3A40068418B53226005F43A6 /* index.html */; }; + 77996CD91C94B825006B0FF7 /* GridClock.m in Sources */ = {isa = PBXBuildFile; fileRef = 77996CD81C94B825006B0FF7 /* GridClock.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 3A40066818B53112005F43A6 /* Grid Clock.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Grid Clock.saver"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3A40066D18B53113005F43A6 /* ScreenSaver.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScreenSaver.framework; path = System/Library/Frameworks/ScreenSaver.framework; sourceTree = SDKROOT; }; + 3A40068218B53129005F43A6 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + 3A40068418B53226005F43A6 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = index.html; sourceTree = SOURCE_ROOT; }; + 3A95A94B18EA12D30036779C /* GridClock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GridClock.h; sourceTree = SOURCE_ROOT; }; + 77996CD61C94B804006B0FF7 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; + 77996CD81C94B825006B0FF7 /* GridClock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GridClock.m; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 3A40066318B53112005F43A6 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3A40068318B53129005F43A6 /* WebKit.framework in Frameworks */, + 3A40066E18B53113005F43A6 /* ScreenSaver.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3A40065D18B53112005F43A6 = { + isa = PBXGroup; + children = ( + 3A40067318B53113005F43A6 /* Source */, + 3A40066A18B53112005F43A6 /* Frameworks */, + 3A40066918B53112005F43A6 /* Products */, + ); + sourceTree = ""; + }; + 3A40066918B53112005F43A6 /* Products */ = { + isa = PBXGroup; + children = ( + 3A40066818B53112005F43A6 /* Grid Clock.saver */, + ); + name = Products; + sourceTree = ""; + }; + 3A40066A18B53112005F43A6 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3A40068218B53129005F43A6 /* WebKit.framework */, + 3A40066D18B53113005F43A6 /* ScreenSaver.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 3A40067318B53113005F43A6 /* Source */ = { + isa = PBXGroup; + children = ( + 3A95A94B18EA12D30036779C /* GridClock.h */, + 77996CD81C94B825006B0FF7 /* GridClock.m */, + 3A40068418B53226005F43A6 /* index.html */, + 77996CD61C94B804006B0FF7 /* Info.plist */, + ); + name = Source; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 3A40066418B53112005F43A6 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 3A40066718B53112005F43A6 /* Grid Clock */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3A40067F18B53113005F43A6 /* Build configuration list for PBXNativeTarget "Grid Clock" */; + buildPhases = ( + 3A40066218B53112005F43A6 /* Sources */, + 3A40066318B53112005F43A6 /* Frameworks */, + 3A40066418B53112005F43A6 /* Headers */, + 3A40066518B53112005F43A6 /* Resources */, + 3A40066618B53112005F43A6 /* Rez */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Grid Clock"; + productReference = 3A40066818B53112005F43A6 /* Grid Clock.saver */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 3A40065E18B53112005F43A6 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0810; + ORGANIZATIONNAME = chrstphrknwtn; + TargetAttributes = { + 3A40066718B53112005F43A6 = { + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 3A40066118B53112005F43A6 /* Build configuration list for PBXProject "Grid Clock" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 3A40065D18B53112005F43A6; + productRefGroup = 3A40066918B53112005F43A6 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 3A40066718B53112005F43A6 /* Grid Clock */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 3A40066518B53112005F43A6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3A40068518B53226005F43A6 /* index.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXRezBuildPhase section */ + 3A40066618B53112005F43A6 /* Rez */ = { + isa = PBXRezBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXRezBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 3A40066218B53112005F43A6 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 77996CD91C94B825006B0FF7 /* GridClock.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 3A40067D18B53113005F43A6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + 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_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; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + 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; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 3A40067E18B53113005F43A6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + 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_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; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + 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; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + SDKROOT = macosx; + }; + name = Release; + }; + 3A40068018B53113005F43A6 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 4699R6ELY7; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Library/Screen Savers"; + PRODUCT_BUNDLE_IDENTIFIER = "com.chrstphrknwtn.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "Grid Clock"; + WRAPPER_EXTENSION = saver; + }; + name = Debug; + }; + 3A40068118B53113005F43A6 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 4699R6ELY7; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(HOME)/Library/Screen Savers"; + PRODUCT_BUNDLE_IDENTIFIER = "com.chrstphrknwtn.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "Grid Clock"; + WRAPPER_EXTENSION = saver; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 3A40066118B53112005F43A6 /* Build configuration list for PBXProject "Grid Clock" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3A40067D18B53113005F43A6 /* Debug */, + 3A40067E18B53113005F43A6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3A40067F18B53113005F43A6 /* Build configuration list for PBXNativeTarget "Grid Clock" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3A40068018B53113005F43A6 /* Debug */, + 3A40068118B53113005F43A6 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 3A40065E18B53112005F43A6 /* Project object */; +} diff --git a/GridClock.h b/GridClock.h new file mode 100755 index 0000000..fe2e15f --- /dev/null +++ b/GridClock.h @@ -0,0 +1,4 @@ +#import + +@interface WSView : ScreenSaverView +@end diff --git a/GridClock.m b/GridClock.m new file mode 100755 index 0000000..7d9fb28 --- /dev/null +++ b/GridClock.m @@ -0,0 +1,44 @@ +#import "GridClock.h" +#import + +@implementation WSView + +- (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview { + if (!(self = [super initWithFrame:frame isPreview:isPreview])) return nil; + + NSURL* indexHTMLDocumentURL = [NSURL URLWithString:[[[NSURL fileURLWithPath:[[NSBundle bundleForClass:self.class].resourcePath stringByAppendingString:@"/index.html"] isDirectory:NO] description] stringByAppendingFormat:@"?screensaver=1%@", self.isPreview ? @"&is_preview=1" : @""]]; + + WebView* webView = [[WebView alloc] initWithFrame:NSMakeRect(0, 0, frame.size.width, frame.size.height)]; + webView.drawsBackground = NO; // Avoids a "white flash" just before the index.html file has loaded + [webView.mainFrame loadRequest:[NSURLRequest requestWithURL:indexHTMLDocumentURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30.0]]; + [self addSubview:webView]; + + return self; +} + +#pragma mark - ScreenSaverView + +- (void)animateOneFrame { [self stopAnimation]; } // We don't need animation callbacks +- (BOOL)hasConfigureSheet { return NO; } // Nothing to configure + +#pragma mark - WebFrameLoadDelegate + +- (void)webView:(WebView *)sender didFailLoadWithError:(NSError *)error forFrame:(WebFrame *)frame { + NSLog(@"%@ error=%@", NSStringFromSelector(_cmd), error); +} + +// A bunch of methods that captures all the input events to prevent so screensaver exits normally. +#pragma mark Focus Overrides + +- (NSView *)hitTest:(NSPoint)aPoint {return self;} +- (void)keyDown:(NSEvent *)theEvent {return;} +- (void)keyUp:(NSEvent *)theEvent {return;} +- (void)mouseDown:(NSEvent *)theEvent {return;} +- (void)mouseUp:(NSEvent *)theEvent {return;} +- (void)mouseDragged:(NSEvent *)theEvent {return;} +- (void)mouseEntered:(NSEvent *)theEvent {return;} +- (void)mouseExited:(NSEvent *)theEvent {return;} +- (BOOL)acceptsFirstResponder {return YES;} +- (BOOL)resignFirstResponder {return NO;} + +@end diff --git a/GridClock.png b/GridClock.png new file mode 100644 index 0000000..8d6f629 Binary files /dev/null and b/GridClock.png differ diff --git a/Info.plist b/Info.plist new file mode 100755 index 0000000..f4ddb21 --- /dev/null +++ b/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + BNDL + CFBundleShortVersionString + 0.0.1 + CFBundleSignature + ???? + CFBundleVersion + 0.0.1 + NSHumanReadableCopyright + Copyright © 2016 Christopher Newton. All rights reserved. + NSPrincipalClass + WSView + + diff --git a/index.html b/index.html new file mode 100755 index 0000000..e432424 --- /dev/null +++ b/index.html @@ -0,0 +1,607 @@ + + + + + + + + + + + + o + n + e + + + + t + w + o + + + + t + h + r + e + e + + + + f + o + u + r + + + s + a + t + + + f + i + v + e + + + + s + i + x + + + + s + e + v + e + n + + + b + e + + + e + i + g + h + t + + + + n + i + n + e + + + + t + e + n + + + s + o + o + n + + + e + l + e + v + e + n + + + + t + w + e + l + v + e + + + + h + a + l + f + + + + q + u + a + r + t + e + r + + + + + m + i + n + u + t + e + + s + + + t + o + + + t + w + e + n + t + y + + + + t + h + i + r + t + e + e + n + + + a + t + + + f + o + u + r + t + e + e + n + + + + f + i + f + t + e + e + n + + + s + + + p + a + s + t + + + + t + o + + + + s + i + x + t + e + e + n + + + c + k + n + + + s + e + v + e + n + t + e + e + n + + + + t + w + e + n + t + y + + + a + + + e + i + g + h + t + e + e + n + + + + n + i + n + e + t + e + e + n + + + + t + h + i + r + t + y + + + + f + o + r + t + y + + + + f + i + f + t + y + + + + o + c + l + o + c + k + + + + o + n + e + + + + t + w + o + + + m + o + o + n + + + t + h + r + e + e + + + + f + o + u + r + + + + f + i + v + e + + + + s + i + x + + + + s + e + v + e + n + + + + e + i + g + h + t + + + + n + i + n + e + + + i + o + + + t + e + n + + + + e + l + e + v + e + n + + + + t + w + e + l + v + e + + + s + + + + + + + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f6ad2da --- /dev/null +++ b/readme.md @@ -0,0 +1,7 @@ +# Grid Clock +Grid clock macOS screensaver + +![Grid Clock Screenshot](GridClock.png) + +## Install +Download [`Grid Clock.saver`](https://github.com/chrstphrknwtn/grid-clock/releases/download/0.0.1/Grid.Clock.saver.zip)