correctly set global autotype on initailizer

This commit is contained in:
Michael Starke
2020-10-08 23:28:54 +02:00
parent bda0a25fe0
commit 2ad4bd2abc
2 changed files with 4 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly) BOOL hidden; /// If set to YES, MacPass was hidden when autotype was initiated
@property (readonly) BOOL isSelfTargeting; /// If MacPass should autotype to itself, YES, otherwise NO
@property (readonly) NSString *overrideSequence; /// If set, this sequence is used for running the command regardless of the matched one
@property (readonly) BOOL globalAutotype;
@property (readonly) BOOL globalAutotype; /// YES, if autotype is run as global autotype, NO otherwise
+ (instancetype)environmentWithTargetApplication:(NSRunningApplication * _Nullable)targetApplication entry:(KPKEntry * _Nullable)entry overrideSequence:(NSString * _Nullable)overrideSequence;

View File

@@ -20,14 +20,16 @@
- (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry *)entry overrideSequence:(NSString *)overrdieSequence {
self = [super init];
if(self) {
_globalAutotype = NO;
_preferredEntry = entry;
_hidden = NSRunningApplication.currentApplication.isHidden;
_overrideSequence = [overrdieSequence copy];
/* capture the front most application if no one was supplied */
if(nil == targetApplication) {
_globalAutotype = YES;
targetApplication = NSWorkspace.sharedWorkspace.frontmostApplication;
}
if(!targetApplication) {
if(nil == targetApplication) {
_pid = -1;
_windowTitle = @"";
}