From c85a9cdce17edc9fb87d65f70d90549b17200172 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Tue, 28 Jan 2020 10:28:42 +0100 Subject: [PATCH] Fixed autotype regression preventing self-autotyping. Added re-hiding for special placeholders --- MacPass/MPAutotypeDaemon.m | 9 ++++++++- MacPass/MPAutotypeEnvironment.m | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index f910d3cb..33ccade9 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -190,7 +190,10 @@ static MPAutotypeDaemon *_sharedInstance; } - (void)_runAutotypeWithEnvironment:(MPAutotypeEnvironment *)env { - + if(env.isSelfTargeting) { + return; // we do not want to target ourselves + } + if(!self.hasNecessaryAutotypePermissions) { NSUserNotification *notification = [[NSUserNotification alloc] init]; notification.title = NSLocalizedString(@"AUTOTYPE_NOTIFICATION_PERMISSIONS_MISSING_TITLE", "Title for autotype feedback on missing permissions"); @@ -329,6 +332,10 @@ static MPAutotypeDaemon *_sharedInstance; usleep(globalDelay*NSEC_PER_USEC); } [command execute]; + /* re-hide after every command since this might have put us back up front */ + if(environment.hidden) { + [NSApplication.sharedApplication hide:nil]; + } }); } } diff --git a/MacPass/MPAutotypeEnvironment.m b/MacPass/MPAutotypeEnvironment.m index 302f6fb1..a1b37ca3 100644 --- a/MacPass/MPAutotypeEnvironment.m +++ b/MacPass/MPAutotypeEnvironment.m @@ -47,7 +47,7 @@ } - (BOOL)isSelfTargeting { - return NSRunningApplication.currentApplication.processIdentifier != _pid; + return NSRunningApplication.currentApplication.processIdentifier == _pid; } - (NSDictionary *)_infoDictionaryForApplication:(NSRunningApplication *)application {