From abcc1630aba65bce31016983545a98bd864ee791 Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Sun, 19 Apr 2026 13:52:05 +0200 Subject: [PATCH 1/2] Run the image extraction on a serial background thread - avoids overwhelming resources --- .../QSObject_FileHandling.m | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Quicksilver/Code-QuickStepCore/QSObject_FileHandling.m b/Quicksilver/Code-QuickStepCore/QSObject_FileHandling.m index 972872aa7..3c5c2e638 100644 --- a/Quicksilver/Code-QuickStepCore/QSObject_FileHandling.m +++ b/Quicksilver/Code-QuickStepCore/QSObject_FileHandling.m @@ -696,45 +696,53 @@ - (id)initWithArray:(NSArray *)paths { #define MAX_IMAGE_SCAN_SIZE 50 * 1024 * 1024 // 50MB +static dispatch_queue_t _textRecognitionQueue; +static dispatch_once_t _textRecognitionQueueToken; + - (void)loadAdditionalSearchContext { if ([[NSUserDefaults standardUserDefaults] boolForKey:kQSDisableExtractTextFromImages]) { return; } if (@available(macOS 10.15, *)) { - + // For images, use text recognition to extract any text and store as searchable context NSString *path = [self validSingleFilePath]; if (!path) { return; } - + NSString *uti = [self fileUTI]; // Check if this is an image file if (!QSTypeConformsTo(uti, (NSString *)kUTTypeImage)) { return; } - + NSURL *fileURL = [NSURL fileURLWithPath:path]; - + if (!fileURL) { return; } - - // skip extracting text for images over 20MB + + // skip extracting text for images over 50MB NSNumber *fileSize = nil; [fileURL getResourceValue:&fileSize forKey:NSURLFileSizeKey error:nil]; if ([fileSize unsignedLongLongValue] > MAX_IMAGE_SCAN_SIZE) return; - + __weak __typeof(self) weakSelf = self; - QSGCDAsync(^{ + // Use a serial queue to avoid overwhelming the system with concurrent Vision requests + dispatch_once(&_textRecognitionQueueToken, ^{ + _textRecognitionQueue = dispatch_queue_create("quicksilver.textrecognition", DISPATCH_QUEUE_SERIAL); + dispatch_set_target_queue(_textRecognitionQueue, dispatch_get_global_queue(QOS_CLASS_UTILITY, 0)); + }); + dispatch_async(_textRecognitionQueue, ^{ // Create a text recognition request VNRecognizeTextRequest *request = [[VNRecognizeTextRequest alloc] initWithCompletionHandler:^(VNRequest *request, NSError *error) { if (error) { NSLog(@"Text recognition error: %@", error); return; } - + NSMutableString *recognizedText = [NSMutableString string]; for (VNRecognizedTextObservation *observation in request.results) { VNRecognizedText *text = [[observation topCandidates:1] firstObject]; From bb3ffb8e3f489c36368011dccb892d84c6972e60 Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Sun, 19 Apr 2026 13:53:02 +0200 Subject: [PATCH 2/2] Version bump --- Quicksilver/Configuration/Developer.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Quicksilver/Configuration/Developer.xcconfig b/Quicksilver/Configuration/Developer.xcconfig index 8d454afb8..829131289 100644 --- a/Quicksilver/Configuration/Developer.xcconfig +++ b/Quicksilver/Configuration/Developer.xcconfig @@ -1,10 +1,10 @@ // This file contains developer-specific information. You can provide temporary overrides to build settings here. // The bundle version displayed in the Finder's Get Info dialog and About Box -QS_INFO_VERSION = 2.5.9 +QS_INFO_VERSION = 2.6.0 // The current development version shown in About Box -QS_BUNDLE_VERSION = 4053 +QS_BUNDLE_VERSION = 4054 // A build of Quicksilver that breaks backwards compatibility for plugins. Setting a value here will mean that all future plugins built with `bltrversion` will have a minimum QS version requirement of this value QS_BACKWARDS_COMPATIBILITY_BREAK = 4001