How to get Dock size?

Is there any way to get dock size?
I got Dock Window using CGWindowListCopyWindowInfo. But I found its frame covers my entire screen.
Same promble as Notification Center.

Any way to get their size?

Replies

Hi Hylas,

The main way you can learn about Dock geometry is via the -[NSScreen visibleFrame] property. That property returns a rect in screen coordinates which excludes the menu bar and Dock (along whichever edge it's configured) if visible. You can derive the inset created by the Dock by diffing this rectangle against the regular -frame property. Note that if there are multiple screens, the Dock will appear on only one of them.