Fixed autotype regression preventing self-autotyping. Added re-hiding for special placeholders

This commit is contained in:
Michael Starke
2020-01-28 10:28:42 +01:00
parent 9409887942
commit c85a9cdce1
2 changed files with 9 additions and 2 deletions

View File

@@ -190,6 +190,9 @@ static MPAutotypeDaemon *_sharedInstance;
} }
- (void)_runAutotypeWithEnvironment:(MPAutotypeEnvironment *)env { - (void)_runAutotypeWithEnvironment:(MPAutotypeEnvironment *)env {
if(env.isSelfTargeting) {
return; // we do not want to target ourselves
}
if(!self.hasNecessaryAutotypePermissions) { if(!self.hasNecessaryAutotypePermissions) {
NSUserNotification *notification = [[NSUserNotification alloc] init]; NSUserNotification *notification = [[NSUserNotification alloc] init];
@@ -329,6 +332,10 @@ static MPAutotypeDaemon *_sharedInstance;
usleep(globalDelay*NSEC_PER_USEC); usleep(globalDelay*NSEC_PER_USEC);
} }
[command execute]; [command execute];
/* re-hide after every command since this might have put us back up front */
if(environment.hidden) {
[NSApplication.sharedApplication hide:nil];
}
}); });
} }
} }

View File

@@ -47,7 +47,7 @@
} }
- (BOOL)isSelfTargeting { - (BOOL)isSelfTargeting {
return NSRunningApplication.currentApplication.processIdentifier != _pid; return NSRunningApplication.currentApplication.processIdentifier == _pid;
} }
- (NSDictionary *)_infoDictionaryForApplication:(NSRunningApplication *)application { - (NSDictionary *)_infoDictionaryForApplication:(NSRunningApplication *)application {