Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

when using the get selection service, if Quicksilver has focus then u…

…se the service on the previous app
  • Loading branch information...
commit 4662962090b7e6ace6b59fa58d506612caa97e2d 1 parent 953723f
Patrick Robertson pjrobertson authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 Quicksilver/Code-QuickStepCore/QSGlobalSelectionProvider.m
14 Quicksilver/Code-QuickStepCore/QSGlobalSelectionProvider.m
View
@@ -78,7 +78,12 @@ - (void)dealloc {
- (void)invokeService {
@autoreleasepool {
- pid_t pid = [[[[NSWorkspace sharedWorkspace] activeApplication] objectForKey:@"NSApplicationProcessIdentifier"] integerValue];
+ // If the active application is Quicksilver, grab the selection from the previous app (QS most likely stole focus)
+ NSDictionary *activeApplication = [[QSProcessMonitor sharedInstance] currentApplication];
+ if ([[activeApplication objectForKey:@"NSApplicationBundleIdentifier"] isEqualToString:@"com.blacktree.Quicksilver"]) {
+ activeApplication = [[QSProcessMonitor sharedInstance] previousApplication];
+ }
+ pid_t pid = [[activeApplication objectForKey:@"NSApplicationProcessIdentifier"] intValue];
if ([NSApplication isLion]) {
//AXUIElement* is unable to post keys into sandboxed app since 10.7, use Quartz Event Services instead
ProcessSerialNumber psn;
@@ -120,10 +125,9 @@ @implementation QSGlobalSelectionProvider
NSTimeInterval failDate = 0;
+ (id)currentSelection {
- NSString *identifier = [[[NSWorkspace sharedWorkspace] activeApplication] objectForKey:@"NSApplicationBundleIdentifier"];
- if ([identifier isEqualToString:kQSBundleID]) return nil;
- NSDictionary *info = [[QSReg tableNamed:@"QSProxies"] objectForKey:identifier];
- if (info) {
+ NSString *identifier = [[[NSWorkspace sharedWorkspace] activeApplication] objectForKey:@"NSApplicationBundleIdentifier"];
+ NSDictionary *info = [[QSReg tableNamed:@"QSProxies"] objectForKey:identifier];
+ if (info) {
id provider = [QSReg getClassInstance:[info objectForKey:kQSProxyProviderClass]];
//if (VERBOSE)
// NSLog(@"Using provider %@ for %@", provider, identifier);
Please sign in to comment.
Something went wrong with that request. Please try again.