diff --git a/.gitignore b/.gitignore index a45d797..e67d2b2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,22 @@ **/*.rs.bk .idea + +# Xcode +.DS_Store +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +*.xcworkspace +!default.xcworkspace +xcuserdata +profile +*.moved-aside +DerivedData +.idea/ \ No newline at end of file diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.pbxproj b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a3fa5be --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.pbxproj @@ -0,0 +1,312 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + B6F9DF16232283F8005233EB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F9DF15232283F8005233EB /* AppDelegate.m */; }; + B6F9DF18232283F8005233EB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B6F9DF17232283F8005233EB /* Assets.xcassets */; }; + B6F9DF1E232283F8005233EB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F9DF1D232283F8005233EB /* main.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + B6F9DF11232283F8005233EB /* EspansoNotifyHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EspansoNotifyHelper.app; sourceTree = BUILT_PRODUCTS_DIR; }; + B6F9DF14232283F8005233EB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + B6F9DF15232283F8005233EB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + B6F9DF17232283F8005233EB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + B6F9DF1C232283F8005233EB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B6F9DF1D232283F8005233EB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + B6F9DF1F232283F8005233EB /* EspansoNotifyHelper.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = EspansoNotifyHelper.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + B6F9DF0E232283F8005233EB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B6F9DF08232283F8005233EB = { + isa = PBXGroup; + children = ( + B6F9DF13232283F8005233EB /* EspansoNotifyHelper */, + B6F9DF12232283F8005233EB /* Products */, + ); + sourceTree = ""; + }; + B6F9DF12232283F8005233EB /* Products */ = { + isa = PBXGroup; + children = ( + B6F9DF11232283F8005233EB /* EspansoNotifyHelper.app */, + ); + name = Products; + sourceTree = ""; + }; + B6F9DF13232283F8005233EB /* EspansoNotifyHelper */ = { + isa = PBXGroup; + children = ( + B6F9DF14232283F8005233EB /* AppDelegate.h */, + B6F9DF15232283F8005233EB /* AppDelegate.m */, + B6F9DF17232283F8005233EB /* Assets.xcassets */, + B6F9DF1C232283F8005233EB /* Info.plist */, + B6F9DF1D232283F8005233EB /* main.m */, + B6F9DF1F232283F8005233EB /* EspansoNotifyHelper.entitlements */, + ); + path = EspansoNotifyHelper; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + B6F9DF10232283F8005233EB /* EspansoNotifyHelper */ = { + isa = PBXNativeTarget; + buildConfigurationList = B6F9DF22232283F8005233EB /* Build configuration list for PBXNativeTarget "EspansoNotifyHelper" */; + buildPhases = ( + B6F9DF0D232283F8005233EB /* Sources */, + B6F9DF0E232283F8005233EB /* Frameworks */, + B6F9DF0F232283F8005233EB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = EspansoNotifyHelper; + productName = EspansoNotifyHelper; + productReference = B6F9DF11232283F8005233EB /* EspansoNotifyHelper.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + B6F9DF09232283F8005233EB /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = "Federico Terzi"; + TargetAttributes = { + B6F9DF10232283F8005233EB = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = B6F9DF0C232283F8005233EB /* Build configuration list for PBXProject "EspansoNotifyHelper" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = B6F9DF08232283F8005233EB; + productRefGroup = B6F9DF12232283F8005233EB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + B6F9DF10232283F8005233EB /* EspansoNotifyHelper */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + B6F9DF0F232283F8005233EB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B6F9DF18232283F8005233EB /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + B6F9DF0D232283F8005233EB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B6F9DF1E232283F8005233EB /* main.m in Sources */, + B6F9DF16232283F8005233EB /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + B6F9DF20232283F8005233EB /* 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++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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.14; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + B6F9DF21232283F8005233EB /* 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++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = 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_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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.14; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + }; + name = Release; + }; + B6F9DF23232283F8005233EB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = EspansoNotifyHelper/EspansoNotifyHelper.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = N69XJWRM3X; + INFOPLIST_FILE = EspansoNotifyHelper/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.federicoterzi.EspansoNotifyHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + B6F9DF24232283F8005233EB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = EspansoNotifyHelper/EspansoNotifyHelper.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = N69XJWRM3X; + INFOPLIST_FILE = EspansoNotifyHelper/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.federicoterzi.EspansoNotifyHelper; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + B6F9DF0C232283F8005233EB /* Build configuration list for PBXProject "EspansoNotifyHelper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B6F9DF20232283F8005233EB /* Debug */, + B6F9DF21232283F8005233EB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + B6F9DF22232283F8005233EB /* Build configuration list for PBXNativeTarget "EspansoNotifyHelper" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B6F9DF23232283F8005233EB /* Debug */, + B6F9DF24232283F8005233EB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = B6F9DF09232283F8005233EB /* Project object */; +} diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..b73ee34 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/xcuserdata/freddy.xcuserdatad/UserInterfaceState.xcuserstate b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/xcuserdata/freddy.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..2ad3786 Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/project.xcworkspace/xcuserdata/freddy.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/xcshareddata/xcschemes/EspansoNotifyHelper.xcscheme b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/xcshareddata/xcschemes/EspansoNotifyHelper.xcscheme new file mode 100644 index 0000000..69a385d --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/xcshareddata/xcschemes/EspansoNotifyHelper.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/xcuserdata/freddy.xcuserdatad/xcschemes/xcschememanagement.plist b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/xcuserdata/freddy.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..396e625 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper.xcodeproj/xcuserdata/freddy.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + EspansoNotifyHelper.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + B6F9DF10232283F8005233EB + + primary + + + + + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/AppDelegate.h b/other/EspansoNotifyHelper/EspansoNotifyHelper/AppDelegate.h new file mode 100644 index 0000000..7c3676c --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// NotificationHelper +// +// Created by Federico on 06/09/2019. +// Copyright © 2019 Federico Terzi. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/AppDelegate.m b/other/EspansoNotifyHelper/EspansoNotifyHelper/AppDelegate.m new file mode 100644 index 0000000..028c9e9 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/AppDelegate.m @@ -0,0 +1,54 @@ +// +// AppDelegate.m +// NotificationHelper +// +// Created by Federico on 06/09/2019. +// Copyright © 2019 Federico Terzi. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@property (weak) IBOutlet NSWindow *window; +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self]; + + NSArray *args = [[NSProcessInfo processInfo] arguments]; + + NSString *title = @"Title"; + NSString *desc = @"Description"; + + if ([args count] > 2) { + title = args[1]; + desc = args[2]; + } + + NSUserNotification *notification = [[NSUserNotification alloc] init]; + notification.title = title; + notification.informativeText = desc; + notification.soundName = nil; + + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + NSRunningApplication *app = [NSRunningApplication currentApplication]; + [app terminate]; + }); +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + +- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification{ + return YES; +} + + +@end diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/Contents.json b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..ce3f357 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icongreen-16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icongreen-32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icongreen-32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icongreen-64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icongreen-128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icongreen-256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icongreen-256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icongreen-512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icongreen-512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icongreen-1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-1024.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-1024.png new file mode 100644 index 0000000..3f2555a Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-1024.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-128.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-128.png new file mode 100644 index 0000000..181c5e8 Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-128.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-16.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-16.png new file mode 100644 index 0000000..355addc Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-16.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-256.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-256.png new file mode 100644 index 0000000..7423ef9 Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-256.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-32.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-32.png new file mode 100644 index 0000000..520331d Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-32.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-512.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-512.png new file mode 100644 index 0000000..4bf1365 Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-512.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-64.png b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-64.png new file mode 100644 index 0000000..e5809ef Binary files /dev/null and b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/AppIcon.appiconset/icongreen-64.png differ diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/Contents.json b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/EspansoNotifyHelper.entitlements b/other/EspansoNotifyHelper/EspansoNotifyHelper/EspansoNotifyHelper.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/EspansoNotifyHelper.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/Info.plist b/other/EspansoNotifyHelper/EspansoNotifyHelper/Info.plist new file mode 100644 index 0000000..6b44964 --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + 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 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2019 Federico Terzi. All rights reserved. + NSMainNibFile + MainMenu + LSUIElement + + NSPrincipalClass + NSApplication + + diff --git a/other/EspansoNotifyHelper/EspansoNotifyHelper/main.m b/other/EspansoNotifyHelper/EspansoNotifyHelper/main.m new file mode 100644 index 0000000..fc6c37f --- /dev/null +++ b/other/EspansoNotifyHelper/EspansoNotifyHelper/main.m @@ -0,0 +1,19 @@ +// +// main.m +// NotificationHelper +// +// Created by Federico on 06/09/2019. +// Copyright © 2019 Federico Terzi. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, const char * argv[]) { + AppDelegate *delegate = [[AppDelegate alloc] init]; + NSApplication * application = [NSApplication sharedApplication]; + [application setDelegate:delegate]; + [NSApp run]; + + return 0; +} diff --git a/src/keyboard/mod.rs b/src/keyboard/mod.rs index f94938e..5e8aaf8 100644 --- a/src/keyboard/mod.rs +++ b/src/keyboard/mod.rs @@ -15,6 +15,12 @@ pub trait KeyboardInterceptor { fn start(&self); } +pub trait KeyboardSender { + fn send_string(&self, s: &str); + fn send_enter(&self); + fn delete_string(&self, count: i32); +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum KeyModifier { CTRL, @@ -36,12 +42,6 @@ pub enum KeyEvent { Modifier(KeyModifier) } -pub trait KeyboardSender { - fn send_string(&self, s: &str); - fn send_enter(&self); - fn delete_string(&self, count: i32); -} - // WINDOWS IMPLEMENTATIONS #[cfg(target_os = "windows")] diff --git a/src/main.rs b/src/main.rs index bd2e1db..b4204f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ mod keyboard; mod matcher; mod engine; mod config; +mod ui; const VERSION: &'static str = env!("CARGO_PKG_VERSION"); @@ -49,6 +50,8 @@ fn main() { } fn espanso_main(configs: Configs) { + let ui_manager = UIManager::new(); + let (txc, rxc) = mpsc::channel(); let sender = keyboard::get_sender(); diff --git a/src/res/mac/EspansoNotifyHelper.zip b/src/res/mac/EspansoNotifyHelper.zip new file mode 100644 index 0000000..6ef3038 Binary files /dev/null and b/src/res/mac/EspansoNotifyHelper.zip differ diff --git a/src/ui/macos.rs b/src/ui/macos.rs new file mode 100644 index 0000000..b033cf0 --- /dev/null +++ b/src/ui/macos.rs @@ -0,0 +1,35 @@ +use std::fs::create_dir_all; + +const NOTIFY_HELPER_BINARY : &'static [u8] = include_bytes!("res/mac/EspansoNotifyHelper.zip"); + +pub struct MacUIManager { + +} + +impl super::UIManager for MacUIManager { + fn initialize(&self) { + self.initialize_notify_helper(); + } + + fn notify(&self, message: &str) { + unimplemented!() + } +} + +impl MacUIManager { + fn initialize_notify_helper(&self) { + let res = dirs::data_dir(); + if let Some(data_dir) = res { + let espanso_dir = data_dir.join("espanso"); + + let res = create_dir_all(espanso_dir); + + if let Ok(_) = res { + // TODO: extract zip file + + } + } + + // TODO: print error message + } +} \ No newline at end of file diff --git a/src/ui/mod.rs b/src/ui/mod.rs new file mode 100644 index 0000000..c7c425c --- /dev/null +++ b/src/ui/mod.rs @@ -0,0 +1,25 @@ +#[cfg(target_os = "windows")] +mod windows; + +#[cfg(target_os = "linux")] +mod linux; + +#[cfg(target_os = "macos")] +mod macos; + +pub trait UIManager { + fn initialize(&self); + fn notify(&self, message: &str); + + fn new() -> impl UIManager { + let manager = get_uimanager(); + manager.initialize(); + manager + } +} + +// MAC IMPLEMENTATION +#[cfg(target_os = "macos")] +fn get_uimanager() -> impl UIManager { + macos::MacUIManager{} +} \ No newline at end of file