fatuhoku
fatuhoku

Reputation: 4911

How do I programmatically move Spaces' focus to a particular Space a window I want to focus on lives on Mac OS X with Objective-C?

In my OSX menubar application, the user can open a particular application NSWindow from a dropdown menu item. Being a menubar application, this is accessible from any Desktop (a Desktop as in a Mission Control 'Space').

I've got a reference to the window programmatically.

Say the user has clicked the menu item while on Desktop 1, the currently active Desktop. Naturally, the NSWindow is created, opened, brought to front. It now lives on Desktop 1

The user browses to Desktop 2, so that it's now the active Desktop.

The user clicks on the menu item again.

Since the window is already open on Desktop 1, I'd like Spaces to automatically bring set the active Desktop to Desktop 1 again, so that the user can see the window he/she wanted to see.

How do I programmatically achieve this with Objective-C Cocoa in OSX?

Upvotes: 3

Views: 984

Answers (0)

Related Questions