mirror of
https://github.com/MacPass/MacPass.git
synced 2026-02-02 05:18:15 +00:00
Added override sequence to autotype environment
This commit is contained in:
@@ -143,13 +143,13 @@ static MPAutotypeDaemon *_sharedInstance;
|
|||||||
|
|
||||||
- (void)performAutotypeForEntry:(KPKEntry *)entry overrideSequence:(NSString *)sequence {
|
- (void)performAutotypeForEntry:(KPKEntry *)entry overrideSequence:(NSString *)sequence {
|
||||||
if(entry) {
|
if(entry) {
|
||||||
MPAutotypeEnvironment *env = [MPAutotypeEnvironment environmentWithTargetApplication:self.previousApplication entry:entry];
|
MPAutotypeEnvironment *env = [MPAutotypeEnvironment environmentWithTargetApplication:self.previousApplication entry:entry overrideSequence:sequence];
|
||||||
[self _runAutotypeWithEnvironment:env];
|
[self _runAutotypeWithEnvironment:env];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_didPressHotKey {
|
- (void)_didPressHotKey {
|
||||||
MPAutotypeEnvironment *env = [MPAutotypeEnvironment environmentWithTargetApplication:NSWorkspace.sharedWorkspace.frontmostApplication entry:nil];
|
MPAutotypeEnvironment *env = [MPAutotypeEnvironment environmentWithTargetApplication:NSWorkspace.sharedWorkspace.frontmostApplication entry:nil overrideSequence:nil];
|
||||||
[self _runAutotypeWithEnvironment:env];
|
[self _runAutotypeWithEnvironment:env];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (readonly, copy) NSString *windowTitle; /// The window title of the target application.
|
@property (readonly, copy) NSString *windowTitle; /// The window title of the target application.
|
||||||
@property (readonly) BOOL hidden; /// If set to YES, MacPass was hidden when autotype was initiated
|
@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) 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
|
||||||
|
|
||||||
+ (instancetype)environmentWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry * _Nullable)entry;
|
+ (instancetype)environmentWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry * _Nullable)entry overrideSequence:(NSString * _Nullable)overrideSequence;
|
||||||
- (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry * _Nullable)entry NS_DESIGNATED_INITIALIZER;
|
- (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry * _Nullable)entry overrideSequence:(NSString * _Nullable)overrdieSequence NS_DESIGNATED_INITIALIZER;
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -13,14 +13,16 @@
|
|||||||
|
|
||||||
@implementation MPAutotypeEnvironment
|
@implementation MPAutotypeEnvironment
|
||||||
|
|
||||||
+ (instancetype)environmentWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry *)entry {
|
+ (instancetype)environmentWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry *)entry overrideSequence:(NSString *)overrideSequence {
|
||||||
return [[MPAutotypeEnvironment alloc] initWithTargetApplication:targetApplication entry:entry];
|
return [[MPAutotypeEnvironment alloc] initWithTargetApplication:targetApplication entry:entry overrideSequence:overrideSequence];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry *)entry {
|
- (instancetype)initWithTargetApplication:(NSRunningApplication *)targetApplication entry:(KPKEntry *)entry overrideSequence:(NSString *)overrdieSequence {
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if(self) {
|
if(self) {
|
||||||
_preferredEntry = entry;
|
_preferredEntry = entry;
|
||||||
|
_hidden = NSRunningApplication.currentApplication.isHidden;
|
||||||
|
_overrideSequence = [overrdieSequence copy];
|
||||||
if(!targetApplication) {
|
if(!targetApplication) {
|
||||||
_pid = -1;
|
_pid = -1;
|
||||||
_windowTitle = @"";
|
_windowTitle = @"";
|
||||||
@@ -41,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_hidden = NSRunningApplication.currentApplication.isHidden;
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user