Dave, can you clarify whether you want is:

1. a notification when the frontmost window changes, or
2. a notification when some application opens a new window?

If #1, observing these NSWorkspace properties looks like the way  to go.  If 
#2, bear in mind that applications can open windows that don't become the 
active window.  For example, it is possible to open links in emails, tweets, 
etc., that cause the browser to open a new window in the background.  The link 
might not open a new window at all, but rather a new tab in an existing browser 
window.

I'm guessing you want #1, which is fortunately the easy (or easier) case. :)  
Just checking.

--Andy

On Sep 5, 2016, at 7:58 PM, [email protected] wrote:
> 
> The two key properties in NSWorkspace
> ARE
> KVO observable. 
> Reading the docs was easy ;)
> frontmostApplication
> And
> menuBarOwningApplication
> 
> Sent from my iPhone
> 
>> On Sep 6, 2016, at 8:36 AM, Alex Zavatone <[email protected]> wrote:
>> 
>> There are examples online for making NSArray observable if these are array 
>> structures. 
>> 
>> If you try this path, try it with a simple case where you make an NSArray 
>> and then change it.
>> 
>> Sent from my iPhone
>> 
>>> On Sep 5, 2016, at 4:25 PM, [email protected] wrote:
>>> 
>>> Not sure if it's KVO observable but NSWorkspace might be worth looking into 
>>> as well as NSRunningApplication
>>> 
>>> Sent from my iPhone
>>> 
>>> On Sep 6, 2016, at 3:55 AM, Dave <[email protected]> wrote:
>>> 
>>>>> Would it be possible to observe which window becomes the front window and 
>>>>> then send a notification?
>>>> 
>>>> That’s what I am trying to find out……
>>>> 
>>>> Cheers
>>>> Dave
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> 
>>>> Cocoa-dev mailing list ([email protected])
>>>> 
>>>> 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:
>>>> https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
>>>> 
>>>> This email sent to [email protected]
>>> 
>>> _______________________________________________
>>> 
>>> Cocoa-dev mailing list ([email protected])
>>> 
>>> 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:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>> 
>>> This email sent to [email protected]
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
> 
> This email sent to [email protected]


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to