Permalink
Browse files

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

…se the service on the previous app
  • Loading branch information...
1 parent 953723f commit 4662962090b7e6ace6b59fa58d506612caa97e2d @pjrobertson pjrobertson committed Jul 31, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 Quicksilver/Code-QuickStepCore/QSGlobalSelectionProvider.m
@@ -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);

0 comments on commit 4662962

Please sign in to comment.