0

Because this app tracks the user using the computer camera, I need it to launch always on the main monitor, where the camera is (iMac/Macbook), on the horizontal center, on top of the screen. Like this:

enter image description here

I know how to make it launch at the top and centered horizontally but my problem is that if the user launches the application by clicking on the doc on the secondary monitor or from double clicking it from the finder on the secondary monitor, the application will launche glued to the top of the secondary monitor. I need it to go for the monitor with the camera, that is the main screen.

Is there a way to do that?

Duck
  • 34,902
  • 47
  • 248
  • 470

1 Answers1

1

You can subclass NSWindow and override constrainFrameRect:toScreen: Please refer https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/index.html#//apple_ref/occ/instm/NSWindow/constrainFrameRect:toScreen:

Sheen Vempeny
  • 818
  • 1
  • 5
  • 8
  • The idea is fantastic but there is a problem. What happens if the user makes the second monitor the main screen? I think it will detect the second monitor, without a camera, as the main one, right? I cannot do the test with this computer of mine cause I have no second monitor right now. Is there a way to check if the mainScreen returned is the computer screen where the camera is? – Duck Feb 05 '15 at 14:56
  • I know there must be a way because About This Mac shows, in my case, the words "iMac" amd LGTV refering to the iMac and my secondary display. – Duck Feb 05 '15 at 15:05