mac helper rewritten in objective c

This commit is contained in:
antelle 2016-08-07 13:55:12 +03:00
parent 4f2f3188a6
commit 08d22f8465
30 changed files with 497 additions and 334 deletions

View File

@ -7,21 +7,20 @@
objects = {
/* Begin PBXBuildFile section */
48395FC01D434F0000BF9A6E /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48395FBF1D434F0000BF9A6E /* main.swift */; };
48395FC71D43E2C100BF9A6E /* InputParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48395FC61D43E2C100BF9A6E /* InputParser.swift */; };
487383751D43E4330034D5BB /* InputCommandBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383741D43E4330034D5BB /* InputCommandBase.swift */; };
487383771D43E9920034D5BB /* NoOpCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383761D43E9920034D5BB /* NoOpCommand.swift */; };
487383791D43EB1E0034D5BB /* CopyPasteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383781D43EB1E0034D5BB /* CopyPasteCommand.swift */; };
4873837D1D43EB460034D5BB /* SendKeyCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4873837C1D43EB460034D5BB /* SendKeyCommand.swift */; };
4873837F1D43EB750034D5BB /* ModifierKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4873837E1D43EB750034D5BB /* ModifierKeys.swift */; };
487383811D43EC000034D5BB /* SendTextCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383801D43EC000034D5BB /* SendTextCommand.swift */; };
487383831D43EC1C0034D5BB /* UnknownCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383821D43EC1C0034D5BB /* UnknownCommand.swift */; };
487383851D43EC360034D5BB /* WaitCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383841D43EC360034D5BB /* WaitCommand.swift */; };
487383871D43FDDF0034D5BB /* KeyRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 487383861D43FDDF0034D5BB /* KeyRunner.swift */; };
48035AAD1D5724FF00EB44C4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035AAC1D5724FF00EB44C4 /* main.m */; };
48035AB41D57263A00EB44C4 /* InputParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035AB31D57263A00EB44C4 /* InputParser.m */; };
48035ABF1D57286F00EB44C4 /* NoOpCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035ABE1D57286F00EB44C4 /* NoOpCommand.m */; };
48035AC11D57393200EB44C4 /* libreadline.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 48035AC01D57393200EB44C4 /* libreadline.tbd */; };
48035AC41D573A8F00EB44C4 /* UnknownCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035AC31D573A8F00EB44C4 /* UnknownCommand.m */; };
48035AC61D573C1200EB44C4 /* WaitCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035AC51D573C1200EB44C4 /* WaitCommand.m */; };
48035ACA1D573E0D00EB44C4 /* CopyPasteCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035AC91D573E0D00EB44C4 /* CopyPasteCommand.m */; };
48035ACD1D573F0600EB44C4 /* SendTextCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035ACC1D573F0600EB44C4 /* SendTextCommand.m */; };
48035AD01D573FD900EB44C4 /* KeyRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035ACF1D573FD900EB44C4 /* KeyRunner.m */; };
48035AD51D57410600EB44C4 /* SendKeyCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 48035AD41D57410600EB44C4 /* SendKeyCommand.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
48395FBA1D434F0000BF9A6E /* CopyFiles */ = {
48035AA71D5724FF00EB44C4 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
@ -33,69 +32,86 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
48395FBC1D434F0000BF9A6E /* KeeWebHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = KeeWebHelper; sourceTree = BUILT_PRODUCTS_DIR; };
48395FBF1D434F0000BF9A6E /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
48395FC61D43E2C100BF9A6E /* InputParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputParser.swift; sourceTree = "<group>"; };
487383741D43E4330034D5BB /* InputCommandBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = InputCommandBase.swift; path = InputCommands/InputCommandBase.swift; sourceTree = "<group>"; };
487383761D43E9920034D5BB /* NoOpCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NoOpCommand.swift; path = InputCommands/NoOpCommand.swift; sourceTree = "<group>"; };
487383781D43EB1E0034D5BB /* CopyPasteCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CopyPasteCommand.swift; path = InputCommands/CopyPasteCommand.swift; sourceTree = "<group>"; };
4873837C1D43EB460034D5BB /* SendKeyCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SendKeyCommand.swift; path = InputCommands/SendKeyCommand.swift; sourceTree = "<group>"; };
4873837E1D43EB750034D5BB /* ModifierKeys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ModifierKeys.swift; path = InputCommands/ModifierKeys.swift; sourceTree = "<group>"; };
487383801D43EC000034D5BB /* SendTextCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SendTextCommand.swift; path = InputCommands/SendTextCommand.swift; sourceTree = "<group>"; };
487383821D43EC1C0034D5BB /* UnknownCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UnknownCommand.swift; path = InputCommands/UnknownCommand.swift; sourceTree = "<group>"; };
487383841D43EC360034D5BB /* WaitCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = WaitCommand.swift; path = InputCommands/WaitCommand.swift; sourceTree = "<group>"; };
487383861D43FDDF0034D5BB /* KeyRunner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyRunner.swift; sourceTree = "<group>"; };
48035AA91D5724FF00EB44C4 /* KeeWebHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = KeeWebHelper; sourceTree = BUILT_PRODUCTS_DIR; };
48035AAC1D5724FF00EB44C4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
48035AB31D57263A00EB44C4 /* InputParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InputParser.m; sourceTree = "<group>"; };
48035AB51D57267600EB44C4 /* InputParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InputParser.h; sourceTree = "<group>"; };
48035AB71D57275600EB44C4 /* InputCommandBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InputCommandBase.h; path = InputCommands/InputCommandBase.h; sourceTree = "<group>"; };
48035ABD1D57286F00EB44C4 /* NoOpCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NoOpCommand.h; path = InputCommands/NoOpCommand.h; sourceTree = "<group>"; };
48035ABE1D57286F00EB44C4 /* NoOpCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NoOpCommand.m; path = InputCommands/NoOpCommand.m; sourceTree = "<group>"; };
48035AC01D57393200EB44C4 /* libreadline.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libreadline.tbd; path = usr/lib/libreadline.tbd; sourceTree = SDKROOT; };
48035AC21D573A8300EB44C4 /* UnknownCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = UnknownCommand.h; path = InputCommands/UnknownCommand.h; sourceTree = "<group>"; };
48035AC31D573A8F00EB44C4 /* UnknownCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UnknownCommand.m; path = InputCommands/UnknownCommand.m; sourceTree = "<group>"; };
48035AC51D573C1200EB44C4 /* WaitCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WaitCommand.m; path = InputCommands/WaitCommand.m; sourceTree = "<group>"; };
48035AC71D573C2200EB44C4 /* WaitCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WaitCommand.h; path = InputCommands/WaitCommand.h; sourceTree = "<group>"; };
48035AC81D573DE800EB44C4 /* CopyPasteCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CopyPasteCommand.h; path = InputCommands/CopyPasteCommand.h; sourceTree = "<group>"; };
48035AC91D573E0D00EB44C4 /* CopyPasteCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CopyPasteCommand.m; path = InputCommands/CopyPasteCommand.m; sourceTree = "<group>"; };
48035ACB1D573EE800EB44C4 /* SendTextCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SendTextCommand.h; path = InputCommands/SendTextCommand.h; sourceTree = "<group>"; };
48035ACC1D573F0600EB44C4 /* SendTextCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SendTextCommand.m; path = InputCommands/SendTextCommand.m; sourceTree = "<group>"; };
48035ACE1D573F8100EB44C4 /* KeyRunner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyRunner.h; sourceTree = "<group>"; };
48035ACF1D573FD900EB44C4 /* KeyRunner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyRunner.m; sourceTree = "<group>"; };
48035AD11D57406700EB44C4 /* SendKeyCommand.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SendKeyCommand.h; path = InputCommands/SendKeyCommand.h; sourceTree = "<group>"; };
48035AD41D57410600EB44C4 /* SendKeyCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SendKeyCommand.m; path = InputCommands/SendKeyCommand.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
48395FB91D434F0000BF9A6E /* Frameworks */ = {
48035AA61D5724FF00EB44C4 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
48035AC11D57393200EB44C4 /* libreadline.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
48395FB31D434F0000BF9A6E = {
48035AA01D5724FF00EB44C4 = {
isa = PBXGroup;
children = (
48395FBE1D434F0000BF9A6E /* KeeWebHelper */,
48395FBD1D434F0000BF9A6E /* Products */,
48035AC01D57393200EB44C4 /* libreadline.tbd */,
48035AAB1D5724FF00EB44C4 /* KeeWebHelper */,
48035AAA1D5724FF00EB44C4 /* Products */,
);
sourceTree = "<group>";
};
48395FBD1D434F0000BF9A6E /* Products */ = {
48035AAA1D5724FF00EB44C4 /* Products */ = {
isa = PBXGroup;
children = (
48395FBC1D434F0000BF9A6E /* KeeWebHelper */,
48035AA91D5724FF00EB44C4 /* KeeWebHelper */,
);
name = Products;
sourceTree = "<group>";
};
48395FBE1D434F0000BF9A6E /* KeeWebHelper */ = {
48035AAB1D5724FF00EB44C4 /* KeeWebHelper */ = {
isa = PBXGroup;
children = (
487383731D43E4180034D5BB /* InputCommands */,
48395FBF1D434F0000BF9A6E /* main.swift */,
48395FC61D43E2C100BF9A6E /* InputParser.swift */,
487383861D43FDDF0034D5BB /* KeyRunner.swift */,
48035AB61D57273300EB44C4 /* InputCommands */,
48035AAC1D5724FF00EB44C4 /* main.m */,
48035AB31D57263A00EB44C4 /* InputParser.m */,
48035AB51D57267600EB44C4 /* InputParser.h */,
48035ACE1D573F8100EB44C4 /* KeyRunner.h */,
48035ACF1D573FD900EB44C4 /* KeyRunner.m */,
);
path = KeeWebHelper;
sourceTree = "<group>";
};
487383731D43E4180034D5BB /* InputCommands */ = {
48035AB61D57273300EB44C4 /* InputCommands */ = {
isa = PBXGroup;
children = (
487383781D43EB1E0034D5BB /* CopyPasteCommand.swift */,
487383741D43E4330034D5BB /* InputCommandBase.swift */,
4873837E1D43EB750034D5BB /* ModifierKeys.swift */,
487383761D43E9920034D5BB /* NoOpCommand.swift */,
4873837C1D43EB460034D5BB /* SendKeyCommand.swift */,
487383801D43EC000034D5BB /* SendTextCommand.swift */,
487383821D43EC1C0034D5BB /* UnknownCommand.swift */,
487383841D43EC360034D5BB /* WaitCommand.swift */,
48035AB71D57275600EB44C4 /* InputCommandBase.h */,
48035ABD1D57286F00EB44C4 /* NoOpCommand.h */,
48035ABE1D57286F00EB44C4 /* NoOpCommand.m */,
48035AC21D573A8300EB44C4 /* UnknownCommand.h */,
48035AC31D573A8F00EB44C4 /* UnknownCommand.m */,
48035AC51D573C1200EB44C4 /* WaitCommand.m */,
48035AC71D573C2200EB44C4 /* WaitCommand.h */,
48035AC81D573DE800EB44C4 /* CopyPasteCommand.h */,
48035AC91D573E0D00EB44C4 /* CopyPasteCommand.m */,
48035ACB1D573EE800EB44C4 /* SendTextCommand.h */,
48035ACC1D573F0600EB44C4 /* SendTextCommand.m */,
48035AD11D57406700EB44C4 /* SendKeyCommand.h */,
48035AD41D57410600EB44C4 /* SendKeyCommand.m */,
);
name = InputCommands;
sourceTree = "<group>";
@ -103,13 +119,13 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
48395FBB1D434F0000BF9A6E /* KeeWebHelper */ = {
48035AA81D5724FF00EB44C4 /* KeeWebHelper */ = {
isa = PBXNativeTarget;
buildConfigurationList = 48395FC31D434F0000BF9A6E /* Build configuration list for PBXNativeTarget "KeeWebHelper" */;
buildConfigurationList = 48035AB01D5724FF00EB44C4 /* Build configuration list for PBXNativeTarget "KeeWebHelper" */;
buildPhases = (
48395FB81D434F0000BF9A6E /* Sources */,
48395FB91D434F0000BF9A6E /* Frameworks */,
48395FBA1D434F0000BF9A6E /* CopyFiles */,
48035AA51D5724FF00EB44C4 /* Sources */,
48035AA61D5724FF00EB44C4 /* Frameworks */,
48035AA71D5724FF00EB44C4 /* CopyFiles */,
);
buildRules = (
);
@ -117,64 +133,61 @@
);
name = KeeWebHelper;
productName = KeeWebHelper;
productReference = 48395FBC1D434F0000BF9A6E /* KeeWebHelper */;
productReference = 48035AA91D5724FF00EB44C4 /* KeeWebHelper */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
48395FB41D434F0000BF9A6E /* Project object */ = {
48035AA11D5724FF00EB44C4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0730;
ORGANIZATIONNAME = KeeWeb;
TargetAttributes = {
48395FBB1D434F0000BF9A6E = {
48035AA81D5724FF00EB44C4 = {
CreatedOnToolsVersion = 7.3.1;
};
};
};
buildConfigurationList = 48395FB71D434F0000BF9A6E /* Build configuration list for PBXProject "KeeWebHelper" */;
buildConfigurationList = 48035AA41D5724FF00EB44C4 /* Build configuration list for PBXProject "KeeWebHelper" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 48395FB31D434F0000BF9A6E;
productRefGroup = 48395FBD1D434F0000BF9A6E /* Products */;
mainGroup = 48035AA01D5724FF00EB44C4;
productRefGroup = 48035AAA1D5724FF00EB44C4 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
48395FBB1D434F0000BF9A6E /* KeeWebHelper */,
48035AA81D5724FF00EB44C4 /* KeeWebHelper */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
48395FB81D434F0000BF9A6E /* Sources */ = {
48035AA51D5724FF00EB44C4 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
487383851D43EC360034D5BB /* WaitCommand.swift in Sources */,
48395FC01D434F0000BF9A6E /* main.swift in Sources */,
487383751D43E4330034D5BB /* InputCommandBase.swift in Sources */,
48395FC71D43E2C100BF9A6E /* InputParser.swift in Sources */,
4873837D1D43EB460034D5BB /* SendKeyCommand.swift in Sources */,
487383791D43EB1E0034D5BB /* CopyPasteCommand.swift in Sources */,
487383871D43FDDF0034D5BB /* KeyRunner.swift in Sources */,
4873837F1D43EB750034D5BB /* ModifierKeys.swift in Sources */,
487383831D43EC1C0034D5BB /* UnknownCommand.swift in Sources */,
487383811D43EC000034D5BB /* SendTextCommand.swift in Sources */,
487383771D43E9920034D5BB /* NoOpCommand.swift in Sources */,
48035ACA1D573E0D00EB44C4 /* CopyPasteCommand.m in Sources */,
48035AD51D57410600EB44C4 /* SendKeyCommand.m in Sources */,
48035AD01D573FD900EB44C4 /* KeyRunner.m in Sources */,
48035AAD1D5724FF00EB44C4 /* main.m in Sources */,
48035AB41D57263A00EB44C4 /* InputParser.m in Sources */,
48035AC61D573C1200EB44C4 /* WaitCommand.m in Sources */,
48035ACD1D573F0600EB44C4 /* SendTextCommand.m in Sources */,
48035AC41D573A8F00EB44C4 /* UnknownCommand.m in Sources */,
48035ABF1D57286F00EB44C4 /* NoOpCommand.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
48395FC11D434F0000BF9A6E /* Debug */ = {
48035AAE1D5724FF00EB44C4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@ -211,15 +224,14 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
48395FC21D434F0000BF9A6E /* Release */ = {
48035AAF1D5724FF00EB44C4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@ -250,20 +262,20 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
name = Release;
};
48395FC41D434F0000BF9A6E /* Debug */ = {
48035AB11D5724FF00EB44C4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
48395FC51D434F0000BF9A6E /* Release */ = {
48035AB21D5724FF00EB44C4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
PRODUCT_NAME = "$(TARGET_NAME)";
@ -273,25 +285,24 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
48395FB71D434F0000BF9A6E /* Build configuration list for PBXProject "KeeWebHelper" */ = {
48035AA41D5724FF00EB44C4 /* Build configuration list for PBXProject "KeeWebHelper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
48395FC11D434F0000BF9A6E /* Debug */,
48395FC21D434F0000BF9A6E /* Release */,
48035AAE1D5724FF00EB44C4 /* Debug */,
48035AAF1D5724FF00EB44C4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
48395FC31D434F0000BF9A6E /* Build configuration list for PBXNativeTarget "KeeWebHelper" */ = {
48035AB01D5724FF00EB44C4 /* Build configuration list for PBXNativeTarget "KeeWebHelper" */ = {
isa = XCConfigurationList;
buildConfigurations = (
48395FC41D434F0000BF9A6E /* Debug */,
48395FC51D434F0000BF9A6E /* Release */,
48035AB11D5724FF00EB44C4 /* Debug */,
48035AB21D5724FF00EB44C4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 48395FB41D434F0000BF9A6E /* Project object */;
rootObject = 48035AA11D5724FF00EB44C4 /* Project object */;
}

View File

@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
#import "InputCommandBase.h"
@interface CopyPasteCommand : NSObject<InputCommandBase> {
NSString *text;
}
- (id)initWithText:(NSString *)aText;
@end

View File

@ -0,0 +1,29 @@
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import "CopyPasteCommand.h"
#import "../KeyRunner.h"
@implementation CopyPasteCommand
- (id)initWithText:(NSString *)aText {
self = [super init];
if (self) {
text = aText;
}
return self;
}
- (void)execute {
usleep(500000);
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
[pasteboard clearContents];
[pasteboard setString:text forType:NSStringPboardType];
usleep(500000);
[KeyRunner keyUpDown:0 code:kVK_Command flags:0 down:true];
[KeyRunner keyPress:0 code:kVK_ANSI_V flags:kCGEventFlagMaskCommand];
[KeyRunner keyUpDown:0 code:kVK_Command flags:0 down:false];
usleep(500000);
}
@end

View File

@ -1,23 +0,0 @@
import Foundation
import Cocoa
import Carbon
class CopyPasteCommand : InputCommandBase {
let text: String
init(text: String) {
self.text = text
}
func execute() {
usleep(500_000)
let pasteboard = NSPasteboard.generalPasteboard();
pasteboard.clearContents()
pasteboard.setString(text, forType: NSStringPboardType)
usleep(500_000)
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Command), flags: nil, down: true)
KeyRunner.keyPress(nil, code: CGKeyCode(kVK_ANSI_V), flags: CGEventFlags.MaskCommand)
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Command), flags: nil, down: false)
usleep(500_000)
}
}

View File

@ -0,0 +1,5 @@
@protocol InputCommandBase
- (void)execute;
@end

View File

@ -1,5 +0,0 @@
import Foundation
protocol InputCommandBase {
func execute()
}

View File

@ -1,11 +0,0 @@
import Foundation
struct ModifierKeys : OptionSetType {
let rawValue: UInt8
static let none = ModifierKeys(rawValue: 0)
static let ctrl = ModifierKeys(rawValue: 1)
static let alt = ModifierKeys(rawValue: 2)
static let shift = ModifierKeys(rawValue: 4)
static let cmd = ModifierKeys(rawValue: 8)
}

View File

@ -0,0 +1,12 @@
#import <Foundation/Foundation.h>
#import "InputCommandBase.h"
@interface NoOpCommand : NSObject<InputCommandBase> {
NSString *message;
}
- (id)init;
- (id)initWithMessage:(NSString *)aMessage;
@end

View File

@ -0,0 +1,24 @@
#import "NoOpCommand.h"
@implementation NoOpCommand
- (id)init {
self = [super init];
return self;
}
- (id)initWithMessage:(NSString *)aMessage {
self = [super init];
if (self) {
message = aMessage;
}
return self;
}
- (void)execute {
if (message) {
NSLog(@"Error: %@", message);
}
}
@end

View File

@ -1,6 +0,0 @@
import Foundation
class NoOpCommand : InputCommandBase {
func execute() {
}
}

View File

@ -0,0 +1,14 @@
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
#import "InputCommandBase.h"
@interface SendKeyCommand : NSObject<InputCommandBase> {
CGKeyCode key;
CGEventFlags modifier;
}
- (id)initWithKey:(CGKeyCode)aKey andModifier:(CGEventFlags)aModifier;
@end

View File

@ -0,0 +1,43 @@
#import "SendKeyCommand.h"
#import "../KeyRunner.h"
@implementation SendKeyCommand
- (id)initWithKey:(CGKeyCode)aKey andModifier:(CGEventFlags)aModifier {
self = [super init];
if (self) {
key = aKey;
modifier = aModifier;
}
return self;
}
- (void)execute {
if (modifier & kCGEventFlagMaskCommand) {
[KeyRunner keyUpDown:0 code:kVK_Command flags:0 down:true];
}
if (modifier & kCGEventFlagMaskAlternate) {
[KeyRunner keyUpDown:0 code:kVK_Option flags:0 down:true];
}
if (modifier & kCGEventFlagMaskControl) {
[KeyRunner keyUpDown:0 code:kVK_Control flags:0 down:true];
}
if (modifier & kCGEventFlagMaskShift) {
[KeyRunner keyUpDown:0 code:kVK_Shift flags:0 down:true];
}
[KeyRunner keyPress:0 code:key flags:modifier];
if (modifier & kCGEventFlagMaskCommand) {
[KeyRunner keyUpDown:0 code:kVK_Command flags:0 down:false];
}
if (modifier & kCGEventFlagMaskAlternate) {
[KeyRunner keyUpDown:0 code:kVK_Option flags:0 down:false];
}
if (modifier & kCGEventFlagMaskControl) {
[KeyRunner keyUpDown:0 code:kVK_Control flags:0 down:false];
}
if (modifier & kCGEventFlagMaskShift) {
[KeyRunner keyUpDown:0 code:kVK_Shift flags:0 down:false];
}
}
@end

View File

@ -1,50 +0,0 @@
import Foundation
import Cocoa
import Carbon
class SendKeyCommand : InputCommandBase {
let key: UInt16
let modifiers: ModifierKeys
init(key: UInt16, modifiers: ModifierKeys) {
self.key = key
self.modifiers = modifiers
}
func execute() {
var rawFlags: UInt64 = 0
if modifiers.contains(ModifierKeys.cmd) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Command), flags: nil, down: true)
rawFlags += CGEventFlags.MaskCommand.rawValue
}
if modifiers.contains(ModifierKeys.alt) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Option), flags: nil, down: true)
rawFlags += CGEventFlags.MaskAlternate.rawValue
}
if modifiers.contains(ModifierKeys.ctrl) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Control), flags: nil, down: true)
rawFlags += CGEventFlags.MaskControl.rawValue
}
if modifiers.contains(ModifierKeys.shift) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Shift), flags: nil, down: true)
rawFlags += CGEventFlags.MaskShift.rawValue
}
let flags: CGEventFlags? = rawFlags == 0 ? nil : CGEventFlags(rawValue: rawFlags)
KeyRunner.keyPress(nil, code: key, flags: flags)
if modifiers.contains(ModifierKeys.shift) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Shift), flags: nil, down: false)
}
if modifiers.contains(ModifierKeys.ctrl) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Control), flags: nil, down: false)
}
if modifiers.contains(ModifierKeys.alt) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Option), flags: nil, down: false)
}
if modifiers.contains(ModifierKeys.cmd) {
KeyRunner.keyUpDown(nil, code: CGKeyCode(kVK_Command), flags: nil, down: false)
}
}
}

View File

@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
#import "InputCommandBase.h"
@interface SendTextCommand : NSObject<InputCommandBase> {
NSString *text;
}
- (id)initWithText:(NSString *)aText;
@end

View File

@ -0,0 +1,21 @@
#import "SendTextCommand.h"
#import "../KeyRunner.h"
@implementation SendTextCommand
- (id)initWithText:(NSString *)aText {
self = [super init];
if (self) {
text = aText;
}
return self;
}
- (void)execute {
for (int i = 0; i < text.length; i++) {
unichar ch = [text characterAtIndex:i];
[KeyRunner keyPress:ch code:0 flags:0];
}
}
@end

View File

@ -1,15 +0,0 @@
import Foundation
class SendTextCommand : InputCommandBase {
let text: String
init(text: String) {
self.text = text
}
func execute() {
for char in text.utf16 {
KeyRunner.keyPress(char)
}
}
}

View File

@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
#import "InputCommandBase.h"
@interface UnknownCommand : NSObject<InputCommandBase> {
NSString *name;
}
- (id)initWithName:(NSString *)aName;
@end

View File

@ -0,0 +1,17 @@
#import "UnknownCommand.h"
@implementation UnknownCommand
- (id)initWithName:(NSString *)aName {
self = [super init];
if (self) {
name = aName;
}
return self;
}
- (void)execute {
NSLog(@"Unknown command: %@", name);
}
@end

View File

@ -1,13 +0,0 @@
import Foundation
class UnknownCommand : InputCommandBase {
let name: String
init(name: String) {
self.name = name
}
func execute() {
fputs("Unknown command: \(name)\n", stderr)
}
}

View File

@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
#import "InputCommandBase.h"
@interface WaitCommand : NSObject<InputCommandBase> {
NSInteger time;
}
- (id)initWithTime:(NSInteger)aTime;
@end

View File

@ -0,0 +1,17 @@
#import "WaitCommand.h"
@implementation WaitCommand
- (id)initWithTime:(NSInteger)aTime {
self = [super init];
if (self) {
time = aTime;
}
return self;
}
- (void)execute {
usleep((unsigned)(time * 1000));
}
@end

View File

@ -1,13 +0,0 @@
import Foundation
class WaitCommand : InputCommandBase {
let interval: UInt32
init(interval: UInt32) {
self.interval = interval
}
func execute() {
usleep(interval * 1_000)
}
}

View File

@ -0,0 +1,9 @@
#import <Foundation/Foundation.h>
#import "InputCommands/InputCommandBase.h"
@interface InputParser : NSObject
- (id<InputCommandBase>)next;
@end

View File

@ -0,0 +1,100 @@
#import <Foundation/Foundation.h>
#import <readline/readline.h>
#import "InputParser.h"
#import "InputCommands/CopyPasteCommand.h"
#import "InputCommands/NoOpCommand.h"
#import "InputCommands/SendKeyCommand.h"
#import "InputCommands/SendTextCommand.h"
#import "InputCommands/UnknownCommand.h"
#import "InputCommands/WaitCommand.h"
@implementation InputParser
- (id<InputCommandBase>)next {
const char *chars = readline(NULL);
if (chars) {
NSString *line = [NSString stringWithUTF8String:chars];
NSString *command = line;
NSRange range = [line rangeOfString:@" "];
if (range.location != NSNotFound) {
command = [line substringToIndex:range.location];
line = [line substringFromIndex:range.location + 1];
}
if (!command.length) {
return [[NoOpCommand alloc] init];
}
if ([command isEqualToString:@"exit"]) {
return nil;
} else if ([command isEqualToString:@"key"]) {
return [self parseSendKeyCommand:line];
} else if ([command isEqualToString:@"text"]) {
if (line.length) {
return [[SendTextCommand alloc] initWithText:line];
} else {
return [[NoOpCommand alloc] init];
}
} else if ([command isEqualToString:@"copypaste"]) {
if (line.length) {
return [[CopyPasteCommand alloc] initWithText:line];
} else {
return [[NoOpCommand alloc] init];
}
} else if ([command isEqualToString:@"wait"]) {
NSInteger time = [line integerValue];
if (time > 0) {
return [[WaitCommand alloc] initWithTime:time];
} else {
return [[NoOpCommand alloc] initWithMessage:@"Bad time"];
}
}
return [[UnknownCommand alloc] initWithName:command];
} else {
return nil;
}
}
- (id<InputCommandBase>)parseSendKeyCommand:(NSString*)args {
if (!args.length) {
return [[NoOpCommand alloc] init];
}
CGEventFlags modifier = 0;
NSCharacterSet *digitChars = [NSCharacterSet decimalDigitCharacterSet];
NSInteger index = 0;
while (args.length) {
unichar firstChar = [args characterAtIndex:index];
if ([digitChars characterIsMember:firstChar]) {
break;
}
switch (firstChar) {
case '^':
modifier |= kCGEventFlagMaskControl;
break;
case '+':
modifier |= kCGEventFlagMaskShift;
break;
case '%':
modifier |= kCGEventFlagMaskAlternate;
break;
case '@':
modifier |= kCGEventFlagMaskCommand;
break;
default:
return [[NoOpCommand alloc] initWithMessage:@"Bad key modifier"];
}
index++;
}
if (index > 0) {
if (index == args.length) {
return [[NoOpCommand alloc] initWithMessage:@"No key code"];
}
args = [args substringFromIndex:index];
}
NSInteger key = [args integerValue];
if (key <= 0) {
return [[NoOpCommand alloc] initWithMessage:@"Bad key code"];
}
return [[SendKeyCommand alloc] initWithKey:(CGKeyCode)key andModifier:modifier];
}
@end

View File

@ -1,66 +0,0 @@
import Foundation
class InputParser {
class func next() -> InputCommandBase? {
let maybeStr = readLine()
if let str = maybeStr {
let parts = str.characters.split(" ", maxSplit: 1)
if parts.count == 0 {
return NoOpCommand()
}
let cmd = String(parts[0])
if cmd.characters.count == 0 {
return NoOpCommand()
}
let cmdArg: String? = parts.count > 1 ? String(parts[1]) : nil
switch cmd {
case "exit":
return nil
case "key":
return cmdArg != nil ? parseSendKeyCommand(cmdArg!) : NoOpCommand()
case "text":
return cmdArg != nil ? SendTextCommand(text: cmdArg!) : NoOpCommand()
case "copypaste":
return cmdArg != nil ? CopyPasteCommand(text: String(parts[1])) : NoOpCommand()
case "wait":
let interval = cmdArg != nil ? UInt32(cmdArg!) : nil
return interval != nil ? WaitCommand(interval: interval!) : NoOpCommand()
default:
return UnknownCommand(name: cmd)
}
}
return nil
}
class func parseSendKeyCommand(text: String) -> InputCommandBase? {
if text.characters.count == 0 {
return NoOpCommand()
}
var modifiers = ModifierKeys()
var keyText = text
while keyText.characters.count > 0 &&
(keyText.characters.first! < "0" || keyText.characters.first! > "9") {
let firstChar = keyText.characters.first!
switch firstChar {
case "^":
modifiers.insert(ModifierKeys.ctrl)
case "+":
modifiers.insert(ModifierKeys.shift)
case "%":
modifiers.insert(ModifierKeys.alt)
case "@":
modifiers.insert(ModifierKeys.cmd)
default:
fputs("Bad modifier: \(firstChar)\n", stderr)
return NoOpCommand()
}
keyText = keyText.substringFromIndex(keyText.startIndex.advancedBy(1))
}
let keyCode = UInt16(keyText)
if keyCode == nil {
fputs("Bad key code: \(keyCode)\n", stderr)
return NoOpCommand()
}
return SendKeyCommand(key: keyCode!, modifiers: modifiers)
}
}

View File

@ -0,0 +1,10 @@
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
@interface KeyRunner : NSObject
+ (void)keyPress:(unichar)ch code:(CGKeyCode)code flags:(CGEventFlags)flags;
+ (void)keyUpDown:(unichar)ch code:(CGKeyCode)code flags:(CGEventFlags)flags down:(bool)down;
@end

View File

@ -0,0 +1,27 @@
#import "KeyRunner.h"
@implementation KeyRunner
CGEventSourceRef eventSource = nil;
+ (void)keyPress:(unichar)ch code:(CGKeyCode)code flags:(CGEventFlags)flags {
[self keyUpDown:ch code:code flags:flags down:false];
[self keyUpDown:ch code:code flags:flags down:true];
}
+ (void)keyUpDown:(unichar)ch code:(CGKeyCode)code flags:(CGEventFlags)flags down:(bool)down {
if (!eventSource) {
eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
}
CGEventRef keyEvent = CGEventCreateKeyboardEvent(eventSource, code, down);
if (ch) {
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch);
}
if (flags) {
CGEventSetFlags(keyEvent, flags);
}
CGEventPost(kCGHIDEventTap, keyEvent);
CFRelease(keyEvent);
}
@end

View File

@ -1,27 +0,0 @@
import Foundation
class KeyRunner {
static let inputSource = CGEventSourceCreate(CGEventSourceStateID.HIDSystemState)
class func keyPress(char: UniChar?,
code: CGKeyCode = 0,
flags: CGEventFlags? = nil) {
keyUpDown(char, code: code, flags: flags, down: true)
keyUpDown(char, code: code, flags: flags, down: false)
}
class func keyUpDown(char: UniChar?,
code: CGKeyCode,
flags: CGEventFlags?,
down: Bool) {
let keyEvent = CGEventCreateKeyboardEvent(KeyRunner.inputSource, code, down)
if (char != nil) {
var ch = char!;
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch)
}
if (flags != nil) {
CGEventSetFlags(keyEvent, flags!)
}
CGEventPost(CGEventTapLocation.CGHIDEventTap, keyEvent)
}
}

View File

@ -0,0 +1,30 @@
#import <Foundation/Foundation.h>
#import <Quartz/Quartz.h>
#import <objc/objc-runtime.h>
#import "InputParser.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray *arguments = [[NSProcessInfo processInfo] arguments];
BOOL printTime = [arguments containsObject:@"--print-time"];
CFTimeInterval startTime = CACurrentMediaTime();
InputParser *parser = [[InputParser alloc] init];
while (true) {
id cmd = [parser next];
if (cmd) {
[cmd execute];
if (printTime) {
int elapsed = (CACurrentMediaTime() - startTime) * 1000;
NSString *name = NSStringFromClass([cmd class]);
NSLog(@"%@: %dms", name, elapsed);
}
} else {
break;
}
}
}
// TODO: ugly way to wait for all keystrokes to be sent. is there a better way?
usleep(100);
return 0;
}

View File

@ -1,21 +0,0 @@
import Foundation
import Quartz
let printTime = Process.arguments.contains("--print-time")
let startTime = CACurrentMediaTime()
while true {
let maybeCommand = InputParser.next()
if let command = maybeCommand {
command.execute()
if (printTime) {
let elapsed = Int((CACurrentMediaTime() - startTime) * 1000);
let name = String(command.dynamicType)
print("\(name): \(elapsed)ms")
}
} else {
break
}
// ugly way to wait for all keystrokes to be sent. is there a better way?
usleep(100);
}