mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 03:09:27 +00:00
Added delay settings key
This commit is contained in:
@@ -318,9 +318,20 @@ static MPAutotypeDaemon *_sharedInstance;
|
||||
/* TODO - we might be able to get a notification to check if the app actually was activated instead of guessing a waiting time */
|
||||
usleep(1 * NSEC_PER_MSEC);
|
||||
}
|
||||
|
||||
useconds_t delay = 0;
|
||||
if(nil != [NSUserDefaults.standardUserDefaults objectForKey:kMPSettingsKeyGlobalAutotypeDelay]) {
|
||||
/* limit the delay to 1000 ms */
|
||||
delay = (useconds_t)MIN([NSUserDefaults.standardUserDefaults integerForKey:kMPSettingsKeyGlobalAutotypeDelay], 1000);
|
||||
}
|
||||
|
||||
|
||||
for(MPAutotypeCommand *command in [MPAutotypeCommand commandsForContext:context]) {
|
||||
/* dispatch commands to main thread since most of them translate key events which is disallowed on background thread */
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if(delay > 0) {
|
||||
usleep(delay * NSEC_PER_MSEC);
|
||||
}
|
||||
[command execute];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchURL; //
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchHost; // Autotype lookup includes host part of entry URL
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchTags; // Autotype lookup includes tags for entries
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeHideAccessibiltyWarning; // Do not show an alert, when MacPass has no support for Autotype
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyGlobalAutotypeDelay; // A global delay in milliseconds for every autotype command to allow for workarounds for broken autotype on some applications (e.g. Steam)
|
||||
|
||||
/* Search */
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyEntrySearchFilterContext;
|
||||
|
||||
@@ -60,6 +60,7 @@ NSString *const kMPSettingsKeyAutotypeMatchURL = @"Autoty
|
||||
NSString *const kMPSettingsKeyAutotypeMatchHost = @"AutotypeMatchHost";
|
||||
NSString *const kMPSettingsKeyAutotypeMatchTags = @"AutotypeMatchTags";
|
||||
NSString *const kMPSettingsKeyAutotypeHideAccessibiltyWarning = @"AutotypeHideAccessibiltyWarning";
|
||||
NSString *const kMPSettingsKeyGlobalAutotypeDelay = @"GlobalAutotypeDelay";
|
||||
|
||||
NSString *const kMPSettingsKeyEntrySearchFilterContext = @"EntrySearchFilterContext";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user