Re: Non-deprecated way to determine Process Type (LSUIElement etc.) ?
Re: Non-deprecated way to determine Process Type (LSUIElement etc.) ?
- Subject: Re: Non-deprecated way to determine Process Type (LSUIElement etc.) ?
- From: Ken Thomases <email@hidden>
- Date: Fri, 27 Nov 2015 01:33:50 -0600
On Nov 27, 2015, at 1:08 AM, Ken Heglund <email@hidden> wrote:
>
> On Nov 26, 2015, at 11:58 PM, Jerry Krinock <email@hidden> wrote:
>>
>> Several years ago I succumbed to a few users who wanted the ability to switch my OS X apps between foreground (regular app) and background (LSUIElement) on the fly. Switching has been possible in both directions since OS X 10.7, using TransformProcessType(). The user interface is, for example, a NSStatusItem (aka “menu extra”).
>>
>> However, in 10.9, Apple deprecated all Process Manager API *except* TransformProcessType(). The deprecated ProcessInformationCopyDictionary(), in particular, was the only way to determine the *current* process type. (The dictionary it returned could have keys LSUIElement or LSBackgroundOnly.)
>> Does anyone know of a non-deprecated way to determine process type? I’ve reviewed NSRunningApplication pretty carefully but this capability appears to have not survived the “upgrade” from Process Manager :(
>
> NSRunningApplication.activationPolicy might do the trick for you.
Don't use NSRunningApplication when NSApplication will do. The replacement for TransformProcessType() is -[NSApplication setActivationPolicy:] and has been since 10.6. The method documentation still claims you can't go from regular back to accessory, but the release notes say you can.
Likewise, you can use -[NSApplication activationPolicy] to query it.
Regards,
(A different) Ken
_______________________________________________
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