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){