Change to other space (MacOSX) programmatically

后端 未结 2 734
名媛妹妹
名媛妹妹 2020-12-14 05:02

I am making a customised window (a NSWindow with NSBorderlessWindowMask) So far I have been able to handle dragging, resizing, cmd+click and even miniaturize with double cli

2条回答
  •  悲&欢浪女
    2020-12-14 05:24

    Unfortunately there's no public API which allows you to do this, but if you're willing to use the Private API it's possible. Take a look at CGSPrivate.h and you'll see you can make a call like this:

    CGSConnection connection = _CGSDefaultConnection();
    CGSMoveWorkspaceWindowList(connection, &windowNumber, 1, newSpaceNumber);   
    

    Note that using this private API will cause your app to be rejected from Apple's Mac App Store though.

提交回复
热议问题