Garrett
Garrett

Reputation: 5630

OS X open URL scheme in background

I'm currently writing an OS X application that implements a custom URL scheme. By design, my app will relatively frequently (about every 2-4 minutes) be opening URLs from an external source. However, this needs to be done in the background (i.e. no GUI or switching of active applications). This is a status bar app (Application is agent (UIElement) set to YES), and has Application UI Presentation Mode set to All Suppressed. While these do prevent any UI elements from being shown upon opening a relevant URL, whatever application window that is active at the time loses focus. Obviously, losing focus on whatever window you're working in every few minutes is a no-go, so how can I prevent this behavior when opening custom URLs?

Upvotes: 3

Views: 497

Answers (1)

Garrett
Garrett

Reputation: 5630

I found my answer. If anyone else ever runs into this problem:

I removed the Application UI Presentation Mode and Application is agent (UIElement) keys from the plist. I set Application is background only to YES. That did the trick. Now the current window no longer loses focus when opening the URL.

Upvotes: 2

Related Questions