Re: Providing a Service without activating an app
Re: Providing a Service without activating an app
- Subject: Re: Providing a Service without activating an app
- From: Kevin Callahan <email@hidden>
- Date: Tue, 02 Apr 2013 13:43:41 -0700
On Apr 2, 2013, at 11:03 AM, Andy Lee <email@hidden> wrote:
> I'm writing an app that provides an NSService. Is there a way to have the app not activate when the service is invoked?
>
> Alternatively -- where can I find good docs and/or sample code for creating a standalone .service bundle?
>
> --Andy
>
Hi Andy - I ran into this same problem.
When Accessorizer first came out in 2002, it was just a standalone NSService, not an app. However, because it needed to grow into an app in order to have settings, options and other things, I converted it to an app. Besides, several developers actually wanted it to be an app so they could work within the app itself.
I couldn't figure out how to keep it from being activated once a service was invoked.
The solution I came up with is two-fold:
1) I inform my users to minimize Accessorizer to the dock. I also have a preference for minimizing to the dock upon launch. So, if a service is invoked, and if Accessorizer is not running, then Accessorizer will launch, minimize itself to the Dock, and perform the service. At least this keeps Accessorizer's interface from being brought to the front and blocking Xcode. However, Accessorizer, at this point in the process, is still the active app. To solve that:
2) I have preferences to activate the editor (Xcode or TextMate) after a Service or Accessorizer Action (Accessorizer uses just one Service invocation for 28 code gen actions that you can pick from a status bar menu or floating menu).
The effect is that you never leave Xcode. This works in full screen mode as well. I have other preferences for auto-inserting the results into Xcode at the current insertion point.
So, basically, my solution was to minimize my app, do the service work, then activate Xcode, then insert results.
Maybe there's a better way?
-Kevin
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden