How to move NSWindow to a specific screen?

In my application, I need to be able to move application windows between screens programmatically. I am working on my MacBookPro and I am connected to a DELL monitor. Therefore, I want to have a method that will transfer my application window from the laptop screen to an external DELL.

Does anyone know how to achieve it?

Any help is much appreciated!

+5
source share
1 answer

[NSScreen screens] gives you an array of NSScreens. A screen with an index of 0 is the one on which your menu is on.

So select another screen from the array, find its visibleFrame and change the frame of your window to go inside it.

+10
source

Source: https://habr.com/ru/post/1481838/


All Articles