From 9b6695e3a0c02ef1078f8d75ab3f005a78e119f9 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Fri, 12 Sep 2008 14:32:15 +0200 Subject: [PATCH] Only show the open dialog if the application is active This fixes an issue where command line arguments were not passed because the repository was already opened. --- ApplicationController.m | 2 +- gitx.mm | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ApplicationController.m b/ApplicationController.m index 704be1f..b7fa10e 100644 --- a/ApplicationController.m +++ b/ApplicationController.m @@ -36,7 +36,7 @@ // Only try to open a default document if there are no documents open already. // For example, the application might have been launched by double-clicking a .git repository, // or by dragging a folder to the app icon - if ([[[PBRepositoryDocumentController sharedDocumentController] documents] count] == 0) { + if ([[[PBRepositoryDocumentController sharedDocumentController] documents] count] == 0 && [[NSApplication sharedApplication] isActive]) { // Try to open the current directory as a git repository NSURL *url = nil; if([[[NSProcessInfo processInfo] environment] objectForKey:@"PWD"]) diff --git a/gitx.mm b/gitx.mm index 2797b04..5091da8 100644 --- a/gitx.mm +++ b/gitx.mm @@ -23,7 +23,10 @@ int main(int argc, const char** argv) if (!proxy) { // If the connection failed, try to launch the app - [[NSWorkspace sharedWorkspace] launchApplication:@"GitX"]; + [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier: @"nl.frim.GitX" + options: NSWorkspaceLaunchWithoutActivation + additionalEventParamDescriptor: nil + launchIdentifier: nil]; // Now attempt to connect, allowing the app time to startup for (int attempt = 0; proxy == nil && attempt < 50; ++attempt){