Home > front end >  Mac OS - Swift - Get screen containing the dock
Mac OS - Swift - Get screen containing the dock

Time:08-01

I would like to get the screen containing the dock and the menubar. Is there a way to do this? I've check Apple documentation about NSScreen but couldn't find any information about that.

Thanks!

CodePudding user response:

Actually, the answer was, as @Willeke suggested, in the documentation of NSScreen.screens (see: https://developer.apple.com/documentation/appkit/nsscreen/1388393-screens).

The screen considered as main (with the menubar) is the one with index 0. It is not the same as NSScreen.main which is the screen with the current active window.

  • Related